Skip to contentSkip to conversation

Patch "target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Jun 3, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST

to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
target-pscsi-don-t-leak-scsi_host-if-hba-is-virtual_host.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 5a7125c64def3b21f8147eca8b54949a60963942 Mon Sep 17 00:00:00 2001

From: Andy Grover <[email protected]>
Date: Fri, 22 May 2015 14:07:44 -0700
Subject: target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST

From: Andy Grover <[email protected]>

commit 5a7125c64def3b21f8147eca8b54949a60963942 upstream.

See https://bugzilla.redhat.com/show_bug.cgi?id=1025672

We need to put() the reference to the scsi host that we got in pscsi_configure_device(). In VIRTUAL_HOST mode it is associated with the dev_virt, not the hba_virt.

---
 drivers/target/target_core_pscsi.c |    3 +++
 drivers/target/target_core_pscsi.h |    1 +
 2 files changed, 4 insertions(+)
drivers/target/target_core_pscsi.c +3 -0
@@ -520,6 +520,7 @@ static int pscsi_configure_device(struct
 					" pdv_host_id: %d\n", pdv->pdv_host_id);
 				return -EINVAL;
 			}
+			pdv->pdv_lld_host = sh;
 		}
 	} else {
 		if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) {
@@ -602,6 +603,8 @@ static void pscsi_free_device(struct se_
 		if ((phv->phv_mode == PHV_LLD_SCSI_HOST_NO) &&
 		    (phv->phv_lld_host != NULL))
 			scsi_host_put(phv->phv_lld_host);
+		else if (pdv->pdv_lld_host)
+			scsi_host_put(pdv->pdv_lld_host);
 
 		if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM))
 			scsi_device_put(sd);
drivers/target/target_core_pscsi.h +1 -0
@@ -45,6 +45,7 @@ struct pscsi_dev_virt {
 	int	pdv_lun_id;
 	struct block_device *pdv_bd;
 	struct scsi_device *pdv_sd;
+	struct Scsi_Host *pdv_lld_host;
 } ____cacheline_aligned;
 
 typedef enum phv_modes {

Patches currently in stable-queue which might be from [email protected] are

queue-3.14/target-pscsi-don-t-leak-scsi_host-if-hba-is-virtual_host.patch