Skip to content

Commit 069c225

Browse files
trondmypdJ. Bruce Fields
authored andcommitted
SUNRPC: lock the socket while detaching it
Prevent callbacks from triggering while we're detaching the socket. Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 104f635 commit 069c225

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/sunrpc/svcsock.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,9 +1611,12 @@ static void svc_sock_detach(struct svc_xprt *xprt)
16111611
dprintk("svc: svc_sock_detach(%p)\n", svsk);
16121612

16131613
/* put back the old socket callbacks */
1614+
lock_sock(sk);
16141615
sk->sk_state_change = svsk->sk_ostate;
16151616
sk->sk_data_ready = svsk->sk_odata;
16161617
sk->sk_write_space = svsk->sk_owspace;
1618+
sk->sk_user_data = NULL;
1619+
release_sock(sk);
16171620

16181621
wq = sk_sleep(sk);
16191622
if (sunrpc_waitqueue_active(wq))

0 commit comments

Comments
 (0)