Skip to contentSkip to conversation

NFC: pn533: fix bulk-message timeout

PATCH Applied Johan Hovold 3 participants 3 messages Jan 13, 2020 – Jan 14, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFC: pn533: fix bulk-message timeout

The driver was doing a synchronous uninterruptible bulk-transfer without using a timeout. This could lead to the driver hanging on probe due to a malfunctioning (or malicious) device until the device is physically disconnected. While sleeping in probe the driver prevents other devices connected to the same hub from being added to (or removed from) the bus.

An arbitrary limit of five seconds should be more than enough.

Fixes dbafc28955fa ("NFC: pn533: don't send USB data off of the stack")
Cc stable <[email protected]> # 4.18
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/nfc/pn533/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/pn533/usb.c +1 -1
index 4590fbf82dc2..f5bb7ace2ff5 100644
@@ -391,7 +391,7 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy)
 		       cmd, sizeof(cmd), false);
 
 	rc = usb_bulk_msg(phy->udev, phy->out_urb->pipe, buffer, sizeof(cmd),
-			  &transferred, 0);
+			  &transferred, 5000);
 	kfree(buffer);
 	if (rc || (transferred != sizeof(cmd))) {
 		nfc_err(&phy->udev->dev,
Signature · 1 line
2.24.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Johan Hovold

The driver was doing a synchronous uninterruptible bulk-transfer without using a timeout. This could lead to the driver hanging on probe due to a malfunctioning (or malicious) device until the device is physically disconnected. While sleeping in probe the driver prevents other devices connected to the same hub from being added to (or removed from) the bus.

An arbitrary limit of five seconds should be more than enough.

Quoted 7 lines
Fixes dbafc28955fa ("NFC: pn533: don't send USB data off of the stack")
Cc stable <[email protected]> # 4.18
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/nfc/pn533/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
In reply to Johan Hovold
Quoted 6 lines · Johan Hovold

The driver was doing a synchronous uninterruptible bulk-transfer without using a timeout. This could lead to the driver hanging on probe due to a malfunctioning (or malicious) device until the device is physically disconnected. While sleeping in probe the driver prevents other devices connected to the same hub from being added to (or removed from) the bus.

Quoted 6 lines

An arbitrary limit of five seconds should be more than enough.

Fixes dbafc28955fa ("NFC: pn533: don't send USB data off of the stack")
Cc stable <[email protected]> # 4.18
Cc Greg Kroah-Hartman <[email protected]>

Applied to net, thank you. In the future please don't CC stable explicitly on networking patches, Dave (or I) will select and send all relevant patches to stable as noted in netdev FAQ.