summaryrefslogtreecommitdiff
path: root/drivers/scsi/hosts.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2015-12-03 20:32:33 +0300
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2015-12-03 20:32:33 +0300
commitbe9e2f775f5a3147205c552534c3abf0f9374a13 (patch)
tree9c10584796d73f80295d9c238a089f12621db316 /drivers/scsi/hosts.c
parente619e6cbecb7fe97a924d625e848605333457b13 (diff)
parent3ddda3e4c82dea58933bde8d0f6ef34470c360cb (diff)
downloadlinux-be9e2f775f5a3147205c552534c3abf0f9374a13.tar.xz
Merge branch 'mkp-fixes' into fixes
Diffstat (limited to 'drivers/scsi/hosts.c')
-rw-r--r--drivers/scsi/hosts.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 323982fd00c3..82ac1cd818ac 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -333,6 +333,17 @@ static void scsi_host_dev_release(struct device *dev)
kfree(queuedata);
}
+ if (shost->shost_state == SHOST_CREATED) {
+ /*
+ * Free the shost_dev device name here if scsi_host_alloc()
+ * and scsi_host_put() have been called but neither
+ * scsi_host_add() nor scsi_host_remove() has been called.
+ * This avoids that the memory allocated for the shost_dev
+ * name is leaked.
+ */
+ kfree(dev_name(&shost->shost_dev));
+ }
+
scsi_destroy_command_freelist(shost);
if (shost_use_blk_mq(shost)) {
if (shost->tag_set.tags)