Skip to content

Commit

Permalink
target: Fix target_sense_desc_format NULL pointer dereference
Browse files Browse the repository at this point in the history
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 4e4937e.

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>
  • Loading branch information
Nicholas Bellinger committed Sep 25, 2015
1 parent eeeb952 commit f3bb467
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/target/target_core_hba.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit f3bb467

Please sign in to comment.