]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: fix a potential NULL pointer dereference in tcp_sk_exit
authorDust Li <dust.li@linux.alibaba.com>
Mon, 1 Apr 2019 08:04:53 +0000 (16:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Apr 2019 17:11:41 +0000 (10:11 -0700)
commitc50973bb87eb242a3e15327c7f30ac48d3d6d19c
tree90a10d72c1a9e02ce8e5de0d7f23ae114b8f6ea7
parentf224dbc9b9ecfb4dc277f9b712445a861ecadc40
tcp: fix a potential NULL pointer dereference in tcp_sk_exit

 When tcp_sk_init() failed in inet_ctl_sock_create(),
 'net->ipv4.tcp_congestion_control' will be left
 uninitialized, but tcp_sk_exit() hasn't check for
 that.

 This patch add checking on 'net->ipv4.tcp_congestion_control'
 in tcp_sk_exit() to prevent NULL-ptr dereference.

Fixes: 01a79ea0c27b ("tcp: Namespace-ify sysctl_tcp_default_congestion_control")
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c