* [PATCH] osd_uld: Check scsi_device_get() return value
@ 2017-03-30 17:17 Bart Van Assche
2017-04-05 16:48 ` Boaz Harrosh
2017-04-06 16:44 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Bart Van Assche @ 2017-03-30 17:17 UTC (permalink / raw)
To: Martin K. Petersen, James Bottomley; +Cc: Boaz Harrosh, linux-scsi
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>
---
drivers/scsi/osd/osd_uld.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index e0ce5d2fd14d..1dea4244dd0c 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);
--
2.12.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] osd_uld: Check scsi_device_get() return value
2017-03-30 17:17 [PATCH] osd_uld: Check scsi_device_get() return value Bart Van Assche
@ 2017-04-05 16:48 ` Boaz Harrosh
2017-04-06 16:44 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Boaz Harrosh @ 2017-04-05 16:48 UTC (permalink / raw)
To: Bart Van Assche, Martin K. Petersen, James Bottomley
Cc: Boaz Harrosh, linux-scsi
On 03/30/2017 08:17 PM, Bart Van Assche wrote:
> 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>
Cool thanks
ACK-by: Boaz Harrosh <ooo@electrozaur.com>
> ---
> drivers/scsi/osd/osd_uld.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
> index e0ce5d2fd14d..1dea4244dd0c 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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] osd_uld: Check scsi_device_get() return value
2017-03-30 17:17 [PATCH] osd_uld: Check scsi_device_get() return value Bart Van Assche
2017-04-05 16:48 ` Boaz Harrosh
@ 2017-04-06 16:44 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-04-06 16:44 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K. Petersen, James Bottomley, Boaz Harrosh, linux-scsi
Bart Van Assche <Bart.VanAssche@sandisk.com> writes:
Bart,
> scsi_device_get() can fail. Hence check its return value.
Applied to 4.12/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-06 16:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 17:17 [PATCH] osd_uld: Check scsi_device_get() return value Bart Van Assche
2017-04-05 16:48 ` Boaz Harrosh
2017-04-06 16:44 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.