summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_hba.c
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-09-16 08:07:45 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-09-25 08:17:23 +0200
commitf3bb467ff64b2598d023b3a07592748fa7768b6a (patch)
tree2c961b5c54a31d3bfc267f7308b2c32c26fd786e /drivers/target/target_core_hba.c
parenttarget: Propigate backend read-only to core_tpg_add_lun (diff)
downloadlinux-f3bb467ff64b2598d023b3a07592748fa7768b6a.tar.xz
linux-f3bb467ff64b2598d023b3a07592748fa7768b6a.zip
target: Fix target_sense_desc_format NULL pointer dereference
This patch allows target_sense_desc_format() to be called without a valid se_device pointer, which can occur during an early exception ahead of transport_lookup_cmd_lun() setting up se_cmd->se_device. This addresses a v4.3-rc1 specific NULL pointer dereference regression introduced by commit 4e4937e8. Cc: Sagi Grimberg <sagig@mellanox.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_hba.c')
-rw-r--r--drivers/target/target_core_hba.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/target/target_core_hba.c b/drivers/target/target_core_hba.c
index 9522960c7fdd..22390e0e046c 100644
--- a/drivers/target/target_core_hba.c
+++ b/drivers/target/target_core_hba.c
@@ -187,5 +187,5 @@ core_delete_hba(struct se_hba *hba)
bool target_sense_desc_format(struct se_device *dev)
{
- return dev->transport->get_blocks(dev) > U32_MAX;
+ return (dev) ? dev->transport->get_blocks(dev) > U32_MAX : false;
}