Skip to contentSkip to conversation

SUNRPC: Fix Oops in xs_tcp_send_request() when transport is disconnected

PATCH New [email protected] 1 participant 1 message May 19, 2021

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 SUNRPC: Fix Oops in xs_tcp_send_request() when transport is disconnected

From: Trond Myklebust <[email protected]>

If a disconnection occurs while we're trying to reply to a server callback, then we may end up calling xs_tcp_send_request() with a NULL value for transport->inet, which trips up the call to tcp_sock_set_cork().

Fixes d737e5d41870 ("SUNRPC: Set TCP_CORK until the transmit queue is empty")
---
 net/sunrpc/xprtsock.c | 2 ++
 1 file changed, 2 insertions(+)
net/sunrpc/xprtsock.c +2 -0
index 47aa47a2b07c..316d04945587 100644
@@ -1010,6 +1010,8 @@ static int xs_tcp_send_request(struct rpc_rqst *req)
 			kernel_sock_shutdown(transport->sock, SHUT_RDWR);
 		return -ENOTCONN;
 	}
+	if (!transport->inet)
+		return -ENOTCONN;
 
 	xs_pktdump("packet data:",
 				req->rq_svec->iov_base,
Signature · 1 line
2.31.1