Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fa677d2 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: avoid NULL deref in inet_ctl_sock_destroy()



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>
parent ec13ad1d
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,


static inline void inet_ctl_sock_destroy(struct sock *sk)
static inline void inet_ctl_sock_destroy(struct sock *sk)
{
{
	if (sk)
		sock_release(sk->sk_socket);
		sock_release(sk->sk_socket);
}
}