aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtrdma/transport.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2020-06-15 09:20:57 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2020-06-22 09:34:35 -0400
commit2d97f4637666704953dfbb10322c2b73bb53d5e7 (patch)
tree72a192f12e27e83fb02939d9ae3f91b3826712c4 /net/sunrpc/xprtrdma/transport.c
parentxprtrdma: Prevent dereferencing r_xprt->rx_ep after it is freed (diff)
downloadlinux-dev-2d97f4637666704953dfbb10322c2b73bb53d5e7.tar.xz
linux-dev-2d97f4637666704953dfbb10322c2b73bb53d5e7.zip
xprtrdma: Use re_connect_status safely in rpcrdma_xprt_connect()
Clean up: Sometimes creating a fresh rpcrdma_ep can fail. That's why xprt_rdma_connect() always checks if the r_xprt->rx_ep pointer is valid before dereferencing it. Instead, xprt_rdma_connect() can simply check rpcrdma_xprt_connect()'s return value. Also, there's no need to set re_connect_status to zero just after the rpcrdma_ep is created, since it is allocated with kzalloc. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/xprtrdma/transport.c')
-rw-r--r--net/sunrpc/xprtrdma/transport.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 0c4af7f5e241..14165b673b20 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -242,7 +242,7 @@ xprt_rdma_connect_worker(struct work_struct *work)
rc = rpcrdma_xprt_connect(r_xprt);
xprt_clear_connecting(xprt);
- if (r_xprt->rx_ep && r_xprt->rx_ep->re_connect_status > 0) {
+ if (!rc) {
xprt->connect_cookie++;
xprt->stat.connect_count++;
xprt->stat.connect_time += (long)jiffies -