target:fix buffer offset in core_scsi3_pri_read_full_status
diff mbox

Message ID 20170817115154.4364-1-tang.wenji@zte.com.cn
State New, archived
Headers show

Commit Message

tang.wenji@zte.com.cn Aug. 17, 2017, 11:51 a.m. UTC
From: tangwenji <tang.wenji@zte.com.cn>

When at least two initiators register pr on the same LUN, the target returns the exception data due to buffer offset error,therefore the initiator executes command 'sg_persist -s' may cause the initiator to appear segfault error.

Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
---
 drivers/target/target_core_pr.c | 1 +
 1 file changed, 1 insertion(+)

Patch
diff mbox

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 6d5def64db61..e2fecbdcec77 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -4010,6 +4010,7 @@  core_scsi3_pri_read_full_status(struct se_cmd *cmd)
 		 * Set the ADDITIONAL DESCRIPTOR LENGTH
 		 */
 		put_unaligned_be32(desc_len, &buf[off]);
+		off += 4;
 		/*
 		 * Size of full desctipor header minus TransportID
 		 * containing $FABRIC_MOD specific) initiator device/port