Re: [PATCH] tcp: fix a potential NULL pointer dereference in tcp_sk_exit

From: David Miller
Date: Mon Apr 01 2019 - 14:05:12 EST


From: Eric Dumazet <edumazet@xxxxxxxxxx>
Date: Mon, 1 Apr 2019 02:23:39 -0700

> On Mon, Apr 1, 2019 at 1:05 AM dust.li <dust.li@xxxxxxxxxxxxxxxxx> wrote:
>>
>> From: Dust Li <dust.li@xxxxxxxxxxxxxxxxx>
>>
>> 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.
>>
>> Signed-off-by: Dust Li <dust.li@xxxxxxxxxxxxxxxxx>
>
> Fixes: 6670e1524477 ("tcp: Namespace-ify sysctl_tcp_default_congestion_control")
> Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>

This patch didn't make it to the list for whatever reason, but I applied it and
have it queued up for -stable.

Thanks.