From: Trond Myklebust Date: Mon, 17 Dec 2018 22:38:51 +0000 (-0500) Subject: SUNRPC: Fix a race with XPRT_CONNECTING X-Git-Tag: MMI-QSB30.62-17~983^2~44^2~68 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8265e34e5705c21978f1e3359c430832110057f1;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git SUNRPC: Fix a race with XPRT_CONNECTING [ Upstream commit cf76785d30712d90185455e752337acdb53d2a5d ] Ensure that we clear XPRT_CONNECTING before releasing the XPRT_LOCK so that we don't have races between the (asynchronous) socket setup code and tasks in xprt_connect(). Signed-off-by: Trond Myklebust Tested-by: Chuck Lever Signed-off-by: Sasha Levin --- diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 30192abfdc3b..05a58cc1b0cd 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2223,8 +2223,8 @@ static void xs_udp_setup_socket(struct work_struct *work) trace_rpc_socket_connect(xprt, sock, 0); status = 0; out: - xprt_unlock_connect(xprt, transport); xprt_clear_connecting(xprt); + xprt_unlock_connect(xprt, transport); xprt_wake_pending_tasks(xprt, status); } @@ -2451,8 +2451,8 @@ static void xs_tcp_setup_socket(struct work_struct *work) } status = -EAGAIN; out: - xprt_unlock_connect(xprt, transport); xprt_clear_connecting(xprt); + xprt_unlock_connect(xprt, transport); xprt_wake_pending_tasks(xprt, status); }