commit: 382436f8804fe1cb20b9a2a811a10eb2d8554721
From: =?UTF-8?q?J=C3=B6rn=20Engel?= <[email protected]>
Date: Wed, 15 Feb 2012 16:51:32 -0500
Subject: target: fix use after free in target_report_luns

Fix possible NULL pointer dereference in target_report_luns failure path.

Signed-off-by: Joern Engel <[email protected]>
Cc: [email protected]
Signed-off-by: Nicholas Bellinger <[email protected]>
---
 drivers/target/target_core_device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/target/target_core_device.c 
b/drivers/target/target_core_device.c
index 27da4e4..b0572f4 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -690,12 +690,12 @@ int target_report_luns(struct se_task *se_task)
         * See SPC3 r07, page 159.
         */
 done:
-       transport_kunmap_data_sg(se_cmd);
        lun_count *= 8;
        buf[0] = ((lun_count >> 24) & 0xff);
        buf[1] = ((lun_count >> 16) & 0xff);
        buf[2] = ((lun_count >> 8) & 0xff);
        buf[3] = (lun_count & 0xff);
+       transport_kunmap_data_sg(se_cmd);
 
        se_task->task_scsi_status = GOOD;
        transport_complete_task(se_task, 1);
-- 
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to