aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/srp
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2012-08-24 06:27:54 -0400
committerRoland Dreier <roland@purestorage.com>2012-09-30 23:36:47 -0400
commit9b796d06d5d1b1e85ae2316a283ea11dd739ef96 (patch)
treebc3a48847b26bc54d3d87f0ae6d264a0ed4ff681 /drivers/infiniband/ulp/srp
parent979570e02981d4a8fc20b3cc8fd651856c98ee9d (diff)
IB/srp: Fix use-after-free in srp_reset_req()
srp_free_req() uses the scsi_cmnd structure contents to unmap buffers, so we must invoke srp_free_req() before we release ownership of that structure. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: David Dillow <dillowda@ornl.gov> Cc: <stable@vger.kernel.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/ulp/srp')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 1b5b0c730054..ac66e6b43ee2 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -638,9 +638,9 @@ static void srp_reset_req(struct srp_target_port *target, struct srp_request *re
638 struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL); 638 struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL);
639 639
640 if (scmnd) { 640 if (scmnd) {
641 srp_free_req(target, req, scmnd, 0);
641 scmnd->result = DID_RESET << 16; 642 scmnd->result = DID_RESET << 16;
642 scmnd->scsi_done(scmnd); 643 scmnd->scsi_done(scmnd);
643 srp_free_req(target, req, scmnd, 0);
644 } 644 }
645} 645}
646 646