[lvc-project] [PATCH] usb host: Fix double locking of mutex 'oxu->mem_lock' in 'oxu_qh_alloc()'

Fedor Pchelkin pchelkin at ispras.ru
Mon Sep 16 21:30:41 MSK 2024


On Mon, 16. Sep 13:43, Mikhail Lobanov wrote:
> Initially, the function oxu_qh_alloc() acquired the mutex oxu->mem_lock,
> and then called the function ehci_qtd_alloc(), which also attempted
> to acquire the same mutex. This led to potential deadlocks.
> 
> Remove the locking from the function ehci_qtd_alloc(). Now, oxu_qh_alloc()
> can call ehci_qtd_alloc() without causing double locking. In all other
> cases where ehci_qtd_alloc() is called, acquire the mutex before the call,
> maintaining mutex locking as in the previous implementation.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: b92a78e582b1 ("usb host: Oxford OXU210HP HCD driver.")
> Signed-off-by: Mikhail Lobanov <m.lobanov at rosalinux.ru>
> ---

Мьютекс (mutex) и спинлок (spinlock) - разные примитивы синхронизации. Патч
затрагивает работу со *спинлоком* oxu->mem_lock. Не стоит эти термины
мешать в одну кучу.

https://docs.kernel.org/locking/locktypes.html



More information about the lvc-project mailing list