Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157356

[PATCH 3.10 21/46] target/pscsi: Dont leak scsi_host if hba is VIRTUAL_HOST

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.10 21/46] target/pscsi: Dont leak scsi_host if hba is VIRTUAL_HOST
Date Wed, 03 Jun 2015 13:50:01 +0200
Message-ID <pxflf-8gc-3@gated-at.bofh.it> (permalink)
References <pxflf-8gc-5@gated-at.bofh.it>
X-Original-To linux-kernel@vger.kernel.org
X-Mailer git-send-email 2.4.2
User-Agent quilt/0.64
MIME-Version 1.0
Content-Type text/plain; charset=ISO-8859-15
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 59
Organization linux.* mail to news gateway
X-Original-Cc Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Andy Grover <agrover@redhat.com>, Nicholas Bellinger <nab@linux-iscsi.org>
X-Original-Date Wed, 3 Jun 2015 20:42:59 +0900
X-Original-Message-ID <20150603063401.472930061@linuxfoundation.org>
X-Original-References <20150603063357.922683803@linuxfoundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1157356

Show key headers only | View raw


3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Grover <agrover@redhat.com>

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.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/target_core_pscsi.c |    3 +++
 drivers/target/target_core_pscsi.h |    1 +
 2 files changed, 4 insertions(+)

--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -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);
--- a/drivers/target/target_core_pscsi.h
+++ b/drivers/target/target_core_pscsi.h
@@ -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 {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.10 21/46] target/pscsi: Dont leak scsi_host if hba is VIRTUAL_HOST Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-06-03 13:50 +0200

csiph-web