scsi: handle command allocation failure in scsi_reset_provider
authorChristoph Hellwig <hch@lst.de>
Thu, 1 May 2014 14:51:05 +0000 (16:51 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 19 May 2014 10:35:10 +0000 (12:35 +0200)
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>
drivers/scsi/scsi_error.c

index f17aa7aa78796e7f6d358b8cd5f68fd43cfee4d4..abe51eab3dc6b97d64a0fc0322682499d53bd33f 100644 (file)
@@ -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;