aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2017-12-14 20:56:01 -0500
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2018-01-16 11:19:41 -0500
commit03ac1a76ce5e5a6052a421e1d6a5c97778e88a8c (patch)
treeb365666da8564f60ded6fe30ae16f002ad523637
parent1291a0d5049dbc06baaaf66a9ff3f53db493b19b (diff)
xprtrdma: Fix buffer leak after transport set up failure
This leak has been around forever, and is exceptionally rare. EINVAL causes mount to fail with "an incorrect mount option was specified" although it's not likely that one of the mount options is incorrect. Instead, return ENODEV in this case, as this appears to be an issue with system or device configuration rather than a specific mount option. Some obsolete comments are also removed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--net/sunrpc/xprtrdma/transport.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 6ee1ad8978f3..7f9b62822807 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -414,20 +414,10 @@ xprt_setup_rdma(struct xprt_create *args)
414 if (rc) 414 if (rc)
415 goto out2; 415 goto out2;
416 416
417 /*
418 * Allocate pre-registered send and receive buffers for headers and
419 * any inline data. Also specify any padding which will be provided
420 * from a preregistered zero buffer.
421 */
422 rc = rpcrdma_buffer_create(new_xprt); 417 rc = rpcrdma_buffer_create(new_xprt);
423 if (rc) 418 if (rc)
424 goto out3; 419 goto out3;
425 420
426 /*
427 * Register a callback for connection events. This is necessary because
428 * connection loss notification is async. We also catch connection loss
429 * when reaping receives.
430 */
431 INIT_DELAYED_WORK(&new_xprt->rx_connect_worker, 421 INIT_DELAYED_WORK(&new_xprt->rx_connect_worker,
432 xprt_rdma_connect_worker); 422 xprt_rdma_connect_worker);
433 423
@@ -448,8 +438,9 @@ xprt_setup_rdma(struct xprt_create *args)
448 return xprt; 438 return xprt;
449 439
450out4: 440out4:
441 rpcrdma_buffer_destroy(&new_xprt->rx_buf);
451 xprt_rdma_free_addresses(xprt); 442 xprt_rdma_free_addresses(xprt);
452 rc = -EINVAL; 443 rc = -ENODEV;
453out3: 444out3:
454 rpcrdma_ep_destroy(new_ep, &new_xprt->rx_ia); 445 rpcrdma_ep_destroy(new_ep, &new_xprt->rx_ia);
455out2: 446out2: