Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: usb: kalmia: validate USB endpoints

The kalmia driver should validate that the device it is probing has the
proper number and types of USB endpoints it is expecting before it binds
to it. If a malicious device were to not have the same urbs the driver
will crash later on when it blindly accesses these endpoints.

Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Fixes: d40261236e8e ("net/usb: Add Samsung Kalmia driver for Samsung GT-B3730")
Link: https://patch.msgid.link/2026022326-shack-headstone-ef6f@gregkh
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Greg Kroah-Hartman and committed by
Jakub Kicinski
c58b6c29 11de1d3a

+7
+7
drivers/net/usb/kalmia.c
··· 132 132 { 133 133 int status; 134 134 u8 ethernet_addr[ETH_ALEN]; 135 + static const u8 ep_addr[] = { 136 + 1 | USB_DIR_IN, 137 + 2 | USB_DIR_OUT, 138 + 0}; 135 139 136 140 /* Don't bind to AT command interface */ 137 141 if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) 138 142 return -EINVAL; 143 + 144 + if (!usb_check_bulk_endpoints(intf, ep_addr)) 145 + return -ENODEV; 139 146 140 147 dev->in = usb_rcvbulkpipe(dev->udev, 0x81 & USB_ENDPOINT_NUMBER_MASK); 141 148 dev->out = usb_sndbulkpipe(dev->udev, 0x02 & USB_ENDPOINT_NUMBER_MASK);