summaryrefslogtreecommitdiff
path: root/drivers/scsi/osd
diff options
context:
space:
mode:
authorBart Van Assche <Bart.VanAssche@sandisk.com>2017-03-30 20:17:17 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2017-04-06 19:43:12 +0300
commitc02465fa13b6232db664c5dcfe9c429b4fe31c99 (patch)
tree9d99b1adefbee5609ceb8529671bb33e95bf929e /drivers/scsi/osd
parent8690218a4c98af41f4abd3dba97bcf468c537629 (diff)
downloadlinux-c02465fa13b6232db664c5dcfe9c429b4fe31c99.tar.xz
scsi: osd_uld: Check scsi_device_get() return value
scsi_device_get() can fail. Hence check its return value. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: Boaz Harrosh <bharrosh@panasas.com> Acked-by: Boaz Harrosh <ooo@electrozaur.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/osd')
-rw-r--r--drivers/scsi/osd/osd_uld.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index c3563a9512b7..ed948025112c 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -464,14 +464,15 @@ static int osd_probe(struct device *dev)
/* hold one more reference to the scsi_device that will get released
* in __release, in case a logout is happening while fs is mounted
*/
- scsi_device_get(scsi_device);
+ if (scsi_device_get(scsi_device))
+ goto err_put_disk;
osd_dev_init(&oud->od, scsi_device);
/* Detect the OSD Version */
error = __detect_osd(oud);
if (error) {
OSD_ERR("osd detection failed, non-compatible OSD device\n");
- goto err_put_disk;
+ goto err_put_sdev;
}
/* init the char-device for communication with user-mode */
@@ -508,8 +509,9 @@ static int osd_probe(struct device *dev)
err_put_cdev:
cdev_del(&oud->cdev);
-err_put_disk:
+err_put_sdev:
scsi_device_put(scsi_device);
+err_put_disk:
put_disk(disk);
err_free_osd:
dev_set_drvdata(dev, NULL);