Skip to contentSkip to conversation

ib_srp: Fix use-after-free in srp_reset_req()

PATCH In review Bart Van Assche 3 participants 4 messages Aug 24, 2012 – Sep 17, 2012 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/infiniband/ulp/srp/ib_srp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +1 -1
index 1b5b0c7..ac66e6b 100644
@@ -638,9 +638,9 @@ static void srp_reset_req(struct srp_target_port *target, struct srp_request *re
 	struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL);
 
 	if (scmnd) {
+		srp_free_req(target, req, scmnd, 0);
 		scmnd->result = DID_RESET << 16;
 		scmnd->scsi_done(scmnd);
-		srp_free_req(target, req, scmnd, 0);
 	}
 }
 
Signature · 6 lines
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive
Quoted 7 lines · Bart Van Assche

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.

Roland, are you planning to apply this one and the one Bart has that fixes the error handling (srp_aport)? I didn't see them in your pull request.

Thanks,

Signature · 10 lines
Dave Dillow
National Center for Computational Science
Oak Ridge National Laboratory
(865) 241-6602 office


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive
Quoted 3 lines · David Dillow

Roland, are you planning to apply this one and the one Bart has that fixes the error handling (srp_aport)? I didn't see them in your pull request.

Sorry, I guess I missed them.

I think I'll probably just put it into 3.7 with a stable tag at this point. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 8 lines · Roland Dreier
Quoted 3 lines · David Dillow

Roland, are you planning to apply this one and the one Bart has that fixes the error handling (srp_aport)? I didn't see them in your pull request.

Sorry, I guess I missed them.

I think I'll probably just put it into 3.7 with a stable tag at this point.

Ok, as long as they make it to stable, I'm happy. Should you happen to have reason for another push for 3.6, please consider them.

Signature · 10 lines
Dave Dillow
National Center for Computational Science
Oak Ridge National Laboratory
(865) 241-6602 office


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html