From: Ming Lei <ming.lei@redhat.com>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org
Cc: Ming Lei <ming.lei@redhat.com>,
John Garry <john.garry@huawei.com>,
Bart Van Assche <bvanassche@acm.org>,
Hannes Reinecke <hare@suse.de>
Subject: [PATCH V2 2/2] scsi: core: put shost->shost_gendev in failure handling path
Date: Fri, 28 May 2021 09:18:38 +0800 [thread overview]
Message-ID: <20210528011838.2122559-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20210528011838.2122559-1-ming.lei@redhat.com>
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 <john.garry@huawei.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
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
prev parent reply other threads:[~2021-05-28 1:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-28 1:18 [PATCH V2 0/2] scsi: two fixes in scsi_add_host_with_dma Ming Lei
2021-05-28 1:18 ` [PATCH V2 1/2] scsi: core: fix failure handling of scsi_add_host_with_dma Ming Lei
2021-05-28 8:34 ` John Garry
2021-05-31 1:22 ` Ming Lei
2021-05-28 1:18 ` Ming Lei [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210528011838.2122559-3-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=john.garry@huawei.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).