pn533_usb_send_frame() submits phy->out_urb and then calls wait_for_completion() with no timeout. During probe this is reached via pn533_finalize_setup() -> pn533_get_firmware_version(), with the USB device lock held by hub_event(). If the device never completes the bulk OUT transfer, the wait never returns: the hub kworker hangs inside probe() and every other task needing that device lock (e.g. usbdev_open()) hangs behind it. Bound the wait with wait_for_completion_timeout(), using the same 5000ms that usb_bulk_msg() gets in pn533_acr122_poweron_rdr(). On timeout, kill the URB (usb_kill_urb() waits for the handler, so the on-stack completion can't be touched after return) and fail with -ETIMEDOUT, which __pn533_send_async() already unwinds. Fixes: 9dab880d675b ("nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame()") Reported-by: syzbot+1c5368988052dc2d8201@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=1c5368988052dc2d8201 Signed-off-by: Nguyen Ngoc Thang --- drivers/nfc/pn533/usb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index efb07f944fce..569b1915afc9 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -184,7 +184,12 @@ static int pn533_usb_send_frame(struct pn533 *dev, if (rc) return rc; - wait_for_completion(&arg.done); + /* device may never ack the OUT transfer: don't hang probe() */ + if (!wait_for_completion_timeout(&arg.done, msecs_to_jiffies(5000))) { + usb_kill_urb(phy->out_urb); /* waits for the handler, so &arg can't outlive us */ + phy->out_urb->context = cntx; + return -ETIMEDOUT; + } phy->out_urb->context = cntx; if (dev->protocol_type == PN533_PROTO_REQ_RESP) { -- 2.43.0