linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tcm: Fix NULL pointer dereference for target_fabric_port_attrs[]
@ 2010-09-22 11:19 Nicholas A. Bellinger
  0 siblings, 0 replies; only message in thread
From: Nicholas A. Bellinger @ 2010-09-22 11:19 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, Joel Becker
  Cc: Christoph Hellwig, FUJITA Tomonori, Mike Christie,
	Hannes Reinecke, James Bottomley, Konrad Rzeszutek Wilk,
	Boaz Harrosh, Joe Eykholt, Nicholas Bellinger

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch fixes a NULL pointer dereference in target_fabric_port_attrs[]
callers when handling the MappedLUN + non existent struct se_lun config_group
case in commit 036866f50e2.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 drivers/target/target_core_fabric_configfs.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
index c689463..5d1a81d 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -517,6 +517,9 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_gp(
 	struct se_lun *lun,
 	char *page)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
@@ -528,6 +531,9 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_gp(
 	const char *page,
 	size_t count)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
@@ -543,6 +549,9 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_offline(
 	struct se_lun *lun,
 	char *page)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
@@ -554,6 +563,9 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_offline(
 	const char *page,
 	size_t count)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
@@ -569,6 +581,9 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_status(
 	struct se_lun *lun,
 	char *page)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
@@ -580,6 +595,9 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_status(
 	const char *page,
 	size_t count)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
@@ -595,6 +613,9 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_write_md(
 	struct se_lun *lun,
 	char *page)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
@@ -606,6 +627,9 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_write_md(
 	const char *page,
 	size_t count)
 {
+	if (!(lun))
+		return -ENODEV;
+
 	if (!(lun->lun_sep))
 		return -ENODEV;
 
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-22 11:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22 11:19 [PATCH 1/2] tcm: Fix NULL pointer dereference for target_fabric_port_attrs[] Nicholas A. Bellinger

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).