* Re: [PATCH] tcp: fix a potential NULL pointer dereference in tcp_sk_exit
[not found] <20190401080453.87465-1-dust.li@linux.alibaba.com>
@ 2019-04-01 9:23 ` Eric Dumazet
2019-04-01 17:12 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2019-04-01 9:23 UTC (permalink / raw)
To: dust.li
Cc: David Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI, netdev, LKML, caspar
On Mon, Apr 1, 2019 at 1:05 AM dust.li <dust.li@linux.alibaba.com> wrote:
>
> From: Dust Li <dust.li@linux.alibaba.com>
>
> 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@linux.alibaba.com>
Fixes: 6670e1524477 ("tcp: Namespace-ify sysctl_tcp_default_congestion_control")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Thanks.
> ---
> net/ipv4/tcp_ipv4.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 277d71239d75..2f8039a26b08 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -2578,7 +2578,8 @@ static void __net_exit tcp_sk_exit(struct net *net)
> {
> int cpu;
>
> - module_put(net->ipv4.tcp_congestion_control->owner);
> + if (net->ipv4.tcp_congestion_control)
> + module_put(net->ipv4.tcp_congestion_control->owner);
>
> for_each_possible_cpu(cpu)
> inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu));
> --
> 2.14.4.44.g2045bb6
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tcp: fix a potential NULL pointer dereference in tcp_sk_exit
2019-04-01 9:23 ` [PATCH] tcp: fix a potential NULL pointer dereference in tcp_sk_exit Eric Dumazet
@ 2019-04-01 17:12 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-04-01 17:12 UTC (permalink / raw)
To: edumazet; +Cc: dust.li, kuznet, yoshfuji, netdev, linux-kernel, caspar
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 1 Apr 2019 02:23:39 -0700
> On Mon, Apr 1, 2019 at 1:05 AM dust.li <dust.li@linux.alibaba.com> wrote:
>>
>> From: Dust Li <dust.li@linux.alibaba.com>
>>
>> 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@linux.alibaba.com>
>
> Fixes: 6670e1524477 ("tcp: Namespace-ify sysctl_tcp_default_congestion_control")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
This patch didn't make it to the list for whatever reason, but I applied it and
have it queued up for -stable.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-01 17:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190401080453.87465-1-dust.li@linux.alibaba.com>
2019-04-01 9:23 ` [PATCH] tcp: fix a potential NULL pointer dereference in tcp_sk_exit Eric Dumazet
2019-04-01 17:12 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).