Re: [PATCH] usb: gadget: f_tcm: reject a short write data-out transfer
From: Yehyeong Lee
Date: Mon Oct 12 2026 - 21:05:24 EST
Thanks - both are addressed in v2.
Deadlock: you are right, the failure path reached bot_send_bad_status() with
cmd->data_len still at the full declared length, so it queued an OUT drain for
data the host had already stopped sending. v2 clears cmd->data_len on this
path - the OUT data phase is over, so the status phase sends the CSW instead
of draining. I confirmed the drain is no longer queued: ep_out stays idle and
only the CSW goes out on ep_in.
Log: v2 uses dev_err_ratelimited() for that message.
For what it is worth, the same bot_send_bad_status() drain is reachable
without this patch by any BOT WRITE that completes its data phase and then
fails in the backend; the failure branch lacks the moved_data guard the
good-status branch has. That is a separate pre-existing issue, left alone
here.
v2: https://lore.kernel.org/linux-usb/20261013005854.2470384-1-yhlee@xxxxxxxxxxxxxxxxxx/
Thanks,
Yehyeong