summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-09-15 23:07:45 -0700
committerNicholas Bellinger <nab@linux-iscsi.org>2015-09-24 23:17:23 -0700
commitf3bb467ff64b2598d023b3a07592748fa7768b6a (patch)
tree2c961b5c54a31d3bfc267f7308b2c32c26fd786e /drivers/target
parenteeeb9522231118138be418ff527dc8c9050f4707 (diff)
downloadlinux-stable-f3bb467ff64b2598d023b3a07592748fa7768b6a.tar.gz
linux-stable-f3bb467ff64b2598d023b3a07592748fa7768b6a.tar.bz2
linux-stable-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')
-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;
}