From: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> commit 98fa00fd3ae43b857b4976984a135483d89d9281 upstream. When respond with check_condition error status, clear from_transport input so the target layer can translate the sense reason reported by f_tcm. Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> Link: https://lore.kernel.org/r/b2a5577efe7abd0af0051229622cf7d3be5cdcd0.1733876548.git.Thinh.Nguyen@xxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1063,7 +1063,7 @@ static void usbg_cmd_work(struct work_st out: transport_send_check_condition_and_sense(se_cmd, - TCM_UNSUPPORTED_SCSI_OPCODE, 1); + TCM_UNSUPPORTED_SCSI_OPCODE, 0); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu, @@ -1192,7 +1192,7 @@ static void bot_cmd_work(struct work_str out: transport_send_check_condition_and_sense(se_cmd, - TCM_UNSUPPORTED_SCSI_OPCODE, 1); + TCM_UNSUPPORTED_SCSI_OPCODE, 0); } static int bot_submit_command(struct f_uas *fu, Patches currently in stable-queue which might be from Thinh.Nguyen@xxxxxxxxxxxx are queue-5.4/usb-gadget-f_tcm-translate-error-to-sense.patch queue-5.4/usb-gadget-f_tcm-ep_autoconfig-with-fullspeed-endpoint.patch queue-5.4/usb-gadget-f_tcm-decrement-command-ref-count-on-cleanup.patch queue-5.4/usb-gadget-f_tcm-don-t-free-command-immediately.patch queue-5.4/usb-gadget-f_tcm-don-t-prepare-bot-write-request-twice.patch