Commit e3478e8c authored by Eric Dumazet's avatar Eric Dumazet Committed by Willy Tarreau

net: avoid NULL deref in inet_ctl_sock_destroy()

[ Upstream commit 8fa677d2 ]

Under low memory conditions, tcp_sk_init() and icmp_sk_init()
can both iterate on all possible cpus and call inet_ctl_sock_destroy(),
with eventual NULL pointer.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
(cherry picked from commit f79c83d6)
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent ad86f123
...@@ -47,7 +47,8 @@ extern int inet_ctl_sock_create(struct sock **sk, ...@@ -47,7 +47,8 @@ extern int inet_ctl_sock_create(struct sock **sk,
static inline void inet_ctl_sock_destroy(struct sock *sk) static inline void inet_ctl_sock_destroy(struct sock *sk)
{ {
sk_release_kernel(sk); if (sk)
sk_release_kernel(sk);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment