Home Home > GIT Browse
diff options
authorNicholas Bellinger <nab@linux-iscsi.org>2015-02-27 03:54:13 -0800
committerSasha Levin <sasha.levin@oracle.com>2015-03-28 10:23:20 -0400
commit4c23efb4e6213c51c9343319a6c3803040b0af1f (patch)
parentaf8524b010eb5fc2ce7df2533f4257d3d46d4d91 (diff)
target/pscsi: Fix NULL pointer dereference in get_device_type
[ Upstream commit 215a8fe4198f607f34ecdbc9969dae783d8b5a61 ] This patch fixes a NULL pointer dereference OOPs with pSCSI backends within target_core_stat.c code. The bug is caused by a configfs attr read if no pscsi_dev_virt->pdv_sd has been configured. Reported-by: Olaf Hering <olaf@aepfle.de> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 7c8291f0bbbc..9a54381e23c6 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -1120,7 +1120,7 @@ static u32 pscsi_get_device_type(struct se_device *dev)
struct pscsi_dev_virt *pdv = PSCSI_DEV(dev);
struct scsi_device *sd = pdv->pdv_sd;
- return sd->type;
+ return (sd) ? sd->type : TYPE_NO_LUN;
static sector_t pscsi_get_blocks(struct se_device *dev)