Re: [PATCH 4/4] scsi: core: only put parent device if host state isn't in SHOST_CREATED
From: John Garry <hidden>
Date: 2021-06-03 15:38:47
From: John Garry <hidden>
Date: 2021-06-03 15:38:47
On 02/06/2021 14:30, Ming Lei wrote:
get_device(shost->shost_gendev.parent) is called after host state is changed to SHOST_RUNNING. So scsi_host_dev_release() shouldn't release the parent device if host state is still SHOST_CREATED. Cc: Bart Van Assche <bvanassche@acm.org> Cc: John Garry <redacted> Cc: Hannes Reinecke <hare@suse.de> Signed-off-by: Ming Lei <redacted> --- drivers/scsi/hosts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 7049844adb6b..34db5be7a562 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c@@ -350,7 +350,7 @@ static void scsi_host_dev_release(struct device *de > ida_simple_remove(&host_index_ida, shost->host_no); - if (parent) + if (shost->shost_state != SHOST_CREATED) put_device(parent); kfree(shost); }
Reviewed-by: John Garry <redacted>