Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2026 20:57:10 +0000
From:      ShengYi Hung <aokblast@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e01b5034a627 - stable/14 - usb: Add missing mtx lock and unlock in pushing dma queue
Message-ID:  <6a3af326.1c37f.280ee49@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by aokblast:

URL: https://cgit.FreeBSD.org/src/commit/?id=e01b5034a627cec33c0cd2768687c7db6db3cbeb

commit e01b5034a627cec33c0cd2768687c7db6db3cbeb
Author:     ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-05-28 08:42:11 +0000
Commit:     ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-06-23 20:56:03 +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
    
    (cherry picked from commit df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2)
---
 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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a3af326.1c37f.280ee49>