提交 64c298b1 编写于 作者: D Dust Li 提交者: Joseph Qi

tcp: fix a potential NULL pointer dereference in tcp_sk_exit

 commit b506bc975f60f06e13e74adb35e708a23dc4e87c upstream.

 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: 6670e152 ("tcp: Namespace-ify sysctl_tcp_default_congestion_control")
Signed-off-by: NDust Li <dust.li@linux.alibaba.com>
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 aff365b6
...@@ -2490,6 +2490,7 @@ static void __net_exit tcp_sk_exit(struct net *net) ...@@ -2490,6 +2490,7 @@ static void __net_exit tcp_sk_exit(struct net *net)
{ {
int cpu; int cpu;
if (net->ipv4.tcp_congestion_control)
module_put(net->ipv4.tcp_congestion_control->owner); module_put(net->ipv4.tcp_congestion_control->owner);
for_each_possible_cpu(cpu) for_each_possible_cpu(cpu)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册