]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: target: spc: Fix RSOC parameter data header size
authorChaohai Chen <wdhh66@163.com>
Wed, 15 Jan 2025 07:07:39 +0000 (15:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 08:45:14 +0000 (10:45 +0200)
[ Upstream commit b50532318793d28a7628c1ffc129a2226e83e495 ]

The SPC document states that "The COMMAND DATA LENGTH field indicates the
length in bytes of the command descriptor list".

The length should be subtracted by 4 to represent the length of the
description list, not 3.

Signed-off-by: Chaohai Chen <wdhh66@163.com>
Link: https://lore.kernel.org/r/20250115070739.216154-1-wdhh66@163.com
Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/target/target_core_spc.c

index 50290abc07bc23869b7aad67ae714756507b0ee8..f110f932ba0543cb20b3c12df628ba84cc7eabb3 100644 (file)
@@ -2243,7 +2243,7 @@ spc_emulate_report_supp_op_codes(struct se_cmd *cmd)
                        response_length += spc_rsoc_encode_command_descriptor(
                                        &buf[response_length], rctd, descr);
                }
-               put_unaligned_be32(response_length - 3, buf);
+               put_unaligned_be32(response_length - 4, buf);
        } else {
                response_length = spc_rsoc_encode_one_command_descriptor(
                                &buf[response_length], rctd, descr,