aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2011-11-30 03:41:20 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2011-12-14 06:42:12 -0500
commit40be67f4c588fe2f3e2dbd60ae1f470abc5b6ad8 (patch)
tree2651859707dfe779766552cde0fce41f5eb19103
parentec54cc081ead14e85736c6543e36ec59be8a7d3d (diff)
target: Fix possible NULL pointer with __transport_execute_tasks
This patch makes __transport_execute_tasks() use a local *se_dev reference to prevent direct se_cmd->se_dev access after transport_cmd_check_stop() -> transport_add_tasks_from_cmd() has been called, as in the current implementation we can expect __transport_execute_tasks() may be called from another context that may have already completed the I/O. Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_transport.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index e4389d40c057..1cc7e920ab0b 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2076,6 +2076,7 @@ static inline int transport_execute_task_attr(struct se_cmd *cmd)
2076static int transport_execute_tasks(struct se_cmd *cmd) 2076static int transport_execute_tasks(struct se_cmd *cmd)
2077{ 2077{
2078 int add_tasks; 2078 int add_tasks;
2079 struct se_device *se_dev = cmd->se_dev;
2079 2080
2080 if (se_dev_check_online(cmd->se_dev) != 0) { 2081 if (se_dev_check_online(cmd->se_dev) != 0) {
2081 cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 2082 cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
@@ -2108,7 +2109,7 @@ static int transport_execute_tasks(struct se_cmd *cmd)
2108 * storage object. 2109 * storage object.
2109 */ 2110 */
2110execute_tasks: 2111execute_tasks:
2111 __transport_execute_tasks(cmd->se_dev); 2112 __transport_execute_tasks(se_dev);
2112 return 0; 2113 return 0;
2113} 2114}
2114 2115