aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Derr <simon.derr@bull.net>2013-06-21 09:32:40 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2013-07-07 23:02:29 -0400
commitb530e252e291c27fdcb1b73c72ad17f75c8bdba6 (patch)
tree0f9c42053871a3b5036d6cc39b7c3847ac539288
parentfd453d0ed6c1dacef8eff466df473d62d63db1e9 (diff)
9P/RDMA: Do not free req->rc in error handling in rdma_request()
rdma_request() should never be in charge of freeing rc. When an error occurs: * Either the rc buffer has been recv_post()'ed. then kfree()'ing it certainly is a bad idea. * Or is has not, and in that case req->rc still points to it, hence it needs not be freed. Signed-off-by: Simon Derr <simon.derr@bull.net> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
-rw-r--r--net/9p/trans_rdma.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index ad8dc331574b..1bd4c7150114 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -447,7 +447,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
447 err = post_recv(client, rpl_context); 447 err = post_recv(client, rpl_context);
448 if (err) { 448 if (err) {
449 p9_debug(P9_DEBUG_FCALL, "POST RECV failed\n"); 449 p9_debug(P9_DEBUG_FCALL, "POST RECV failed\n");
450 goto err_free1; 450 goto err_free;
451 } 451 }
452 452
453 /* remove posted receive buffer from request structure */ 453 /* remove posted receive buffer from request structure */
@@ -457,7 +457,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
457 c = kmalloc(sizeof *c, GFP_NOFS); 457 c = kmalloc(sizeof *c, GFP_NOFS);
458 if (!c) { 458 if (!c) {
459 err = -ENOMEM; 459 err = -ENOMEM;
460 goto err_free1; 460 goto err_free;
461 } 461 }
462 c->req = req; 462 c->req = req;
463 463
@@ -486,13 +486,10 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
486 486
487 error: 487 error:
488 kfree(c); 488 kfree(c);
489 kfree(rpl_context->rc);
490 kfree(rpl_context); 489 kfree(rpl_context);
491 p9_debug(P9_DEBUG_ERROR, "EIO\n"); 490 p9_debug(P9_DEBUG_ERROR, "EIO\n");
492 return -EIO; 491 return -EIO;
493 err_free1: 492 err_free:
494 kfree(rpl_context->rc);
495 err_free2:
496 kfree(rpl_context); 493 kfree(rpl_context);
497 err_close: 494 err_close:
498 spin_lock_irqsave(&rdma->req_lock, flags); 495 spin_lock_irqsave(&rdma->req_lock, flags);