net: qrtr: Detach socket from sock during release

There is a race between releasing a socket and a sock structure. Skbs
still in flight may hold references to the sock structure, preventing
it from being freed when the socket is released. Detach the socket in
the release call to prevent references to that sockets resources.

Change-Id: I44ac553cf73b3a2148ce50d7552c39b08f5e0f91
Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
Chris Lew 2018-09-28 12:13:36 -07:00 • committed by Gerrit - the friendly Code Review server
commit 0d116bcb6a

View file

@ -1252,7 +1252,7 @@ static int qrtr_release(struct socket *sock)
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_state_change(sk);
sock_set_flag(sk, SOCK_DEAD);
sock_orphan(sk);
sock->sk = NULL;
if (!sock_flag(sk, SOCK_ZAPPED))