[PATCH v7 1/3] usb: gadget: f_tcm: queue the BOT status requests with GFP_ATOMIC

From: Yehyeong Lee

Date: Tue Oct 13 2026 - 03:38:19 EST


bot_send_bad_status() and bot_send_status() run from endpoint completion
callbacks - bot_send_bad_status() via usbg_data_write_cmpl()'s cleanup
path, and both of them via bot_read_compl() after a BOT read. Those
callbacks are called with interrupts disabled and must not sleep, but both
functions queue the status or drain request with GFP_KERNEL, which can.

Queue with GFP_ATOMIC, like the other usb_ep_queue() calls reached from the
same callbacks (bot_enqueue_sense_code() and bot_err_compl()).

Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Yehyeong Lee <yhlee@xxxxxxxxxxxxxxxxxx>
---
drivers/usb/gadget/function/f_tcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
index 9e6d4f39900a2..12e2b20e33b92 100644
--- a/drivers/usb/gadget/function/f_tcm.c
+++ b/drivers/usb/gadget/function/f_tcm.c
@@ -139,7 +139,7 @@ static void bot_send_bad_status(struct usbg_cmd *cmd)
req->complete = bot_err_compl;
req->context = cmd;
req->buf = fu->cmd[0].buf;
- usb_ep_queue(ep, req, GFP_KERNEL);
+ usb_ep_queue(ep, req, GFP_ATOMIC);
} else {
bot_enqueue_sense_code(fu, cmd);
}
@@ -167,7 +167,7 @@ static int bot_send_status(struct usbg_cmd *cmd, bool moved_data)
csw->Status = US_BULK_STAT_OK;
fu->bot_status.req->context = cmd;

- ret = usb_ep_queue(fu->ep_in, fu->bot_status.req, GFP_KERNEL);
+ ret = usb_ep_queue(fu->ep_in, fu->bot_status.req, GFP_ATOMIC);
if (ret)
pr_err("%s(%d) ERR: %d\n", __func__, __LINE__, ret);
} else {
--
2.43.0