Merge "net: sockev: avoid races between sockev and socket_close"

This commit is contained in:
Linux Build Service Account 2019-05-20 09:12:58 -07:00 committed by Gerrit - the friendly Code Review server
commit eddc389f5a

View file

@ -73,11 +73,13 @@ static int sockev_client_cb(struct notifier_block *nb,
sock = (struct socket *)data;
if (!socknlmsgsk || !sock)
goto done;
goto sk_null;
sk = sock->sk;
if (!sk)
goto done;
goto sk_null;
sock_hold(sk);
if (sk->sk_family != AF_INET && sk->sk_family != AF_INET6)
goto done;
@ -108,6 +110,8 @@ static int sockev_client_cb(struct notifier_block *nb,
smsg->skflags = sk->sk_flags;
nlmsg_notify(socknlmsgsk, skb, 0, SKNLGRP_SOCKEV, 0, GFP_KERNEL);
done:
sock_put(sk);
sk_null:
return 0;
}