Thread (5 messages) 5 messages, 2 authors, 2021-05-31
STALE1871d
Revisions (2)
  1. v2 current
  2. v3 [diff vs current]

[PATCH V2 2/2] scsi: core: put shost->shost_gendev in failure handling path

From: Ming Lei <hidden>
Date: 2021-05-28 01:19:08
Subsystem: scsi subsystem, the rest · Maintainers: "James E.J. Bottomley", "Martin K. Petersen", Linus Torvalds

get_device(&shost->shost_gendev) is called in scsi_add_host_with_dma(),
but its counter pair isn't called in the failure path, so fix it
by calling put_device(&shost->shost_gendev) in its failure path.

Reported-by: John Garry <redacted>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ming Lei <redacted>
---
 drivers/scsi/hosts.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index ea50856cb203..492b64f349e1 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -295,6 +295,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 	 * scsi_host_dev_release, so not free them in the failure path
 	 */
  out_del_dev:
+	put_device(&shost->shost_gendev);
 	device_del(&shost->shost_dev);
  out_del_gendev:
 	device_del(&shost->shost_gendev);
-- 
2.29.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help