All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target: Fix target_sense_desc_format NULL pointer dereference
@ 2015-09-16  6:31 Nicholas A. Bellinger
  2015-09-16 12:08 ` Sagi Grimberg
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas A. Bellinger @ 2015-09-16  6:31 UTC (permalink / raw)
  To: target-devel
  Cc: linux-scsi, Nicholas Bellinger, Sagi Grimberg, Christoph Hellwig,
	Hannes Reinecke

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

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>
---
 drivers/target/target_core_hba.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_hba.c b/drivers/target/target_core_hba.c
index 9522960..22390e0 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;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-17  6:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16  6:31 [PATCH] target: Fix target_sense_desc_format NULL pointer dereference Nicholas A. Bellinger
2015-09-16 12:08 ` Sagi Grimberg
2015-09-17  4:04   ` Nicholas A. Bellinger
2015-09-17  6:53     ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.