git: df5e9e3da5b9 - main - usb: Add missing mtx lock and unlock in pushing dma queue
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 May 2026 14:36:59 UTC
The branch main has been updated by aokblast:
URL: https://cgit.FreeBSD.org/src/commit/?id=df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2
commit df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2
Author: ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-05-28 08:42:11 +0000
Commit: ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-05-28 14:36:10 +0000
usb: Add missing mtx lock and unlock in pushing dma queue
Accessing usb_xfer_queue requires bus lock, we added this missing lock
in here to prevent racing issue.
Reviewed by: adrian
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57293
---
sys/dev/usb/usb_transfer.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c
index 67745cf49397..d41121ed3a06 100644
--- a/sys/dev/usb/usb_transfer.c
+++ b/sys/dev/usb/usb_transfer.c
@@ -1889,8 +1889,10 @@ usbd_transfer_submit(struct usb_xfer *xfer)
*/
#if USB_HAVE_BUSDMA
if (xfer->flags_int.bdma_enable) {
+ USB_BUS_LOCK(bus);
/* insert the USB transfer last in the BUS-DMA queue */
usb_command_wrapper(&xfer->xroot->dma_q, xfer);
+ USB_BUS_UNLOCK(bus);
return;
}
#endif