summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-05-01 16:51:05 +0200
committerChristoph Hellwig <hch@lst.de>2014-05-19 12:35:10 +0200
commit95eeb5f5880cd390fd59710f64dc7b84d1e9942f (patch)
tree7ef92673ed5c1509f543817b047db2e2fd5e7195
parentscsi: reintroduce scsi_driver.init_command (diff)
downloadlinux-95eeb5f5880cd390fd59710f64dc7b84d1e9942f.tar.xz
linux-95eeb5f5880cd390fd59710f64dc7b84d1e9942f.zip
scsi: handle command allocation failure in scsi_reset_provider
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de>
-rw-r--r--drivers/scsi/scsi_error.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index f17aa7aa7879..abe51eab3dc6 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2306,6 +2306,12 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
}
scmd = scsi_get_command(dev, GFP_KERNEL);
+ if (!scmd) {
+ rtn = FAILED;
+ put_device(&dev->sdev_gendev);
+ goto out_put_autopm_host;
+ }
+
blk_rq_init(NULL, &req);
scmd->request = &req;