Commit ebbbef61 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Make sure nothing happens to a dead rpc/tcp socket

Just make sure that once SK_DEAD is set, nothing is attempted on the socket.
parent de9974b1
...@@ -147,6 +147,8 @@ svc_sock_enqueue(struct svc_sock *svsk) ...@@ -147,6 +147,8 @@ svc_sock_enqueue(struct svc_sock *svsk)
if (!(svsk->sk_flags & if (!(svsk->sk_flags &
( (1<<SK_CONN)|(1<<SK_DATA)|(1<<SK_CLOSE)|(1<<SK_DEFERRED)) )) ( (1<<SK_CONN)|(1<<SK_DATA)|(1<<SK_CLOSE)|(1<<SK_DEFERRED)) ))
return; return;
if (test_bit(SK_DEAD, &svsk->sk_flags))
return;
spin_lock_bh(&serv->sv_lock); spin_lock_bh(&serv->sv_lock);
...@@ -1029,6 +1031,9 @@ svc_tcp_sendto(struct svc_rqst *rqstp) ...@@ -1029,6 +1031,9 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
reclen = htonl(0x80000000|((xbufp->len ) - 4)); reclen = htonl(0x80000000|((xbufp->len ) - 4));
memcpy(xbufp->head[0].iov_base, &reclen, 4); memcpy(xbufp->head[0].iov_base, &reclen, 4);
if (test_bit(SK_DEAD, &rqstp->rq_sock->sk_flags))
return -ENOTCONN;
sent = svc_sendto(rqstp, &rqstp->rq_res); sent = svc_sendto(rqstp, &rqstp->rq_res);
if (sent != xbufp->len) { if (sent != xbufp->len) {
printk(KERN_NOTICE "rpc-srv/tcp: %s: %s %d when sending %d bytes - shutting down socket\n", printk(KERN_NOTICE "rpc-srv/tcp: %s: %s %d when sending %d bytes - shutting down socket\n",
......
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