Skip to content

Commit b5e6fa7

Browse files
jhovoldholtmann
authored andcommitted
Bluetooth: bfusb: fix division by zero in send path
Add the missing bulk-out endpoint sanity check to probe() to avoid division by zero in bfusb_send_frame() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing). Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")). Cc: [email protected] Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 2a7ca74 commit b5e6fa7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/bluetooth/bfusb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
628628
data->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress;
629629
data->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize);
630630

631+
if (!data->bulk_pkt_size)
632+
goto done;
633+
631634
rwlock_init(&data->lock);
632635

633636
data->reassembly = NULL;

0 commit comments

Comments
 (0)