Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

target: Fix return sense reason in target_scsi3_emulate_pr_out

The sense reason should be TCM_PARAMETER_LIST_LENGTH_ERROR when
parmeter length error.

Also the cdb[1] & 0x1f has been assigned to local variable sa,
so use sa instead of it.

Signed-off-by: Tang Wenji <tang.wenji@zte.com.cn>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

authored by

Tang Wenji and committed by
Nicholas Bellinger
7ee00317 388fe699

+5 -5
+5 -5
drivers/target/target_core_pr.c
··· 3585 3585 if (cmd->data_length < 24) { 3586 3586 pr_warn("SPC-PR: Received PR OUT parameter list" 3587 3587 " length too small: %u\n", cmd->data_length); 3588 - return TCM_INVALID_PARAMETER_LIST; 3588 + return TCM_PARAMETER_LIST_LENGTH_ERROR; 3589 3589 } 3590 3590 3591 3591 /* ··· 3629 3629 /* 3630 3630 * SPEC_I_PT=1 is only valid for Service action: REGISTER 3631 3631 */ 3632 - if (spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER)) 3632 + if (spec_i_pt && (sa != PRO_REGISTER)) 3633 3633 return TCM_INVALID_PARAMETER_LIST; 3634 3634 3635 3635 /* ··· 3641 3641 * the sense key set to ILLEGAL REQUEST, and the additional sense 3642 3642 * code set to PARAMETER LIST LENGTH ERROR. 3643 3643 */ 3644 - if (!spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER_AND_MOVE) && 3644 + if (!spec_i_pt && (sa != PRO_REGISTER_AND_MOVE) && 3645 3645 (cmd->data_length != 24)) { 3646 3646 pr_warn("SPC-PR: Received PR OUT illegal parameter" 3647 3647 " list length: %u\n", cmd->data_length); 3648 - return TCM_INVALID_PARAMETER_LIST; 3648 + return TCM_PARAMETER_LIST_LENGTH_ERROR; 3649 3649 } 3650 3650 3651 3651 /* ··· 3685 3685 break; 3686 3686 default: 3687 3687 pr_err("Unknown PERSISTENT_RESERVE_OUT service" 3688 - " action: 0x%02x\n", cdb[1] & 0x1f); 3688 + " action: 0x%02x\n", sa); 3689 3689 return TCM_INVALID_CDB_FIELD; 3690 3690 } 3691 3691