]> git.baikalelectronics.ru Git - kernel.git/commit
net: Fix one possible memleak in ip_setup_cork
authorGao Feng <gfree.wind@vip.163.com>
Mon, 16 Apr 2018 02:16:45 +0000 (10:16 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Apr 2018 16:57:06 +0000 (12:57 -0400)
commit7cfb6c2a9b764a7f133cfae75ed51c1f48884263
treef84e130010e48668777e5dc15b114bf3fecc1707
parent7220928d26093cacaeb663c39052cb224f7d5a0c
net: Fix one possible memleak in ip_setup_cork

It would allocate memory in this function when the cork->opt is NULL. But
the memory isn't freed if failed in the latter rt check, and return error
directly. It causes the memleak if its caller is ip_make_skb which also
doesn't free the cork->opt when meet a error.

Now move the rt check ahead to avoid the memleak.

Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_output.c