]> exis.tech > repos - linux.git/commitdiff
usb: mtu3: unmap request DMA on queue failure
authorHaoxiang Li <haoxiang_li2024@163.com>
Tue, 23 Jun 2026 09:33:25 +0000 (17:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jun 2026 15:04:26 +0000 (16:04 +0100)
mtu3_gadget_queue() maps the request before checking whether
the QMU GPD ring can accept another transfer. the request is
returned with -EAGAIN before it is linked on the endpoint
request list if mtu3_prepare_transfer() fails.

Normal completion and dequeue paths unmap requests from
mtu3_req_complete(), but this error path never reaches that
helper, so the DMA mapping is left active. Unmap the request
before returning from the failed queue path.

Fixes: df2069acb005 ("usb: Add MediaTek USB3 DRD driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Link: https://patch.msgid.link/20260623093325.2105323-1-haoxiang_li2024@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/mtu3/mtu3_gadget.c

index da29f467943f0d6c2c0c79aa14235045935ad505..f224f2ee379abede867082817c4ce8c5ff5c0b65 100644 (file)
@@ -305,6 +305,7 @@ static int mtu3_gadget_queue(struct usb_ep *ep,
 
        if (mtu3_prepare_transfer(mep)) {
                ret = -EAGAIN;
+               usb_gadget_unmap_request(&mtu->g, req, mep->is_in);
                goto error;
        }