NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/53739: usbhidctl blocks forever if usbhidaction is running on the same device
>Number: 53739
>Category: kern
>Synopsis: usbhidctl blocks forever if usbhidaction is running on the same device
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Nov 25 00:25:00 +0000 2018
>Originator: Rob Braun
>Release: NetBSD 8.99.26
>Organization:
>Environment:
pinebook
>Description:
When usbhidaction is running and you run usbhidctl, usbhidctl will be stuck in uninterruptible wait until either an event comes in to wake usbhidaction, or usbhidaction exits. usbhidctl's uhidev_open blocks trying to acquire sc->sc_lock before checking sc_state & UHIDEV_OPEN. But usbhidaction's uhid_do_read holds that lock while waiting for an event.
>How-To-Repeat:
Start usbhidaction:
/usr/bin/usbhidaction -c /etc/usbhidaction.conf -f /dev/uhid0 -i -p /var/run/usbhidaction-uhid0.pid
usbhidaction is now blocked in read() on the device, which is parked in uhid_do_read doing a cv_wait_sig() holding sc->sc_lock.
Run usbhidctl against the same device (or anything that attempts to open the device usbhidaction is using, including accidentally running usbhidaction again):
/usr/bin/usbhidctl -f /dev/uhid0 -v -r -a
usbhidctl will attempt to open the device, which attempts to acquire the sc_lock that usbhidaction's read holds.
Check ps, usbhidctl will be in state "D+" and unkillable.
Waking up usbhidaction's read with either a signal, or generating an event on the device will cause usbhidctl to wake up and return EBUSY.
>Fix:
Home |
Main Index |
Thread Index |
Old Index