uart: fix sleeping while holding mutex in uart_tty_detach()
Move swi_remove() call before acquiring the tty lock. swi_remove() calls intr_event_remove_handler() which may sleep via msleep(), causing a lock order violation when called with the tty mutex held. The software interrupt handler removal operates on the interrupt event structure independently and does not require the tty lock. This matches the pattern used in other drivers such as tcp_hpts.c where swi_remove() is called without holding other locks. Reviewed by: imp, kevans MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D54953
This commit is contained in:
committed by
Kyle Evans
parent
d3f21856aa
commit
ed3a2469a7
@@ -447,8 +447,9 @@ uart_tty_detach(struct uart_softc *sc)
|
||||
|
||||
tp = sc->sc_u.u_tty.tp;
|
||||
|
||||
tty_lock(tp);
|
||||
swi_remove(sc->sc_softih);
|
||||
|
||||
tty_lock(tp);
|
||||
tty_rel_gone(tp);
|
||||
|
||||
return (0);
|
||||
|
||||
Reference in New Issue
Block a user