From: tangwenji Date: Thu, 17 Aug 2017 11:51:54 +0000 (+0800) Subject: target: fix buffer offset in core_scsi3_pri_read_full_status X-Git-Tag: rel_imx_4.19.35_1.1.0~11196^2~32 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=c58a252beb04cf0e02d6a746b2ed7ea89b6deb71;p=linux.git target: fix buffer offset in core_scsi3_pri_read_full_status 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. This fixes a regression originally introduced by: commit a85d667e58bddf73be84d1981b41eaac985ed216 Author: Bart Van Assche Date: Tue May 23 16:48:27 2017 -0700 target: Use {get,put}_unaligned_be*() instead of open coding these functions Signed-off-by: tangwenji Cc: stable@vger.kernel.org # 4.13+ Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index dd2cd8048582..9f25c9c6f67d 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -4011,6 +4011,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