summaryrefslogtreecommitdiff
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-11-15 20:30:53 -0800
committerBrian Norris <computersforpeace@gmail.com>2015-11-15 20:31:29 -0800
commit617f41836c17688141e1c66f4156c2084f8ca86d (patch)
treee57d631bb3bb061a0ff2e99bc85f94bd1c30598f /drivers/scsi/sg.c
parent26add94cd535d1e000e7871fe69c7bb89e942d67 (diff)
parent8005c49d9aea74d382f474ce11afbbc7d7130bec (diff)
Merge v4.4-rc1 into MTD development
Sync up with the upstream development. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 9d7b7db75e4b..503ab8b46c0b 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -787,8 +787,14 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
return k; /* probably out of space --> ENOMEM */
}
if (atomic_read(&sdp->detaching)) {
- if (srp->bio)
+ if (srp->bio) {
+ if (srp->rq->cmd != srp->rq->__cmd)
+ kfree(srp->rq->cmd);
+
blk_end_request_all(srp->rq, -EIO);
+ srp->rq = NULL;
+ }
+
sg_finish_rem_req(srp);
return -ENODEV;
}