net: usb: kalmia: validate USB endpoints
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 1/1 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.
--- drivers/net/usb/kalmia.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/usb/kalmia.c +7 -0
@@ -132,11 +132,18 @@ kalmia_bind(struct usbnet *dev, struct usb_interface *intf) {int status;u8 ethernet_addr[ETH_ALEN ]; +static const u8 ep_addr[] = { +1 |USB_DIR_IN , +2 |USB_DIR_OUT , +0 };/* Don't bind to AT command interface */ if (intf->cur_altsetting->desc.bInterfaceClass !=USB_CLASS_VENDOR_SPEC )return -EINVAL ; +if (!usb_check_bulk_endpoints (intf, ep_addr)) +return -ENODEV ; + dev->in =usb_rcvbulkpipe (dev->udev,0x81 &USB_ENDPOINT_NUMBER_MASK ); dev->out =usb_sndbulkpipe (dev->udev,0x02 &USB_ENDPOINT_NUMBER_MASK ); dev->status =NULL ;
Signature · 1 line
2.53.0
Quoted 8 lines · Greg Kroah-Hartman
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 <[email protected]>Assisted-by gkh_clanker_2000Signed-off-by Greg Kroah-Hartman <[email protected]>
Hi Greg,
As a fix I think this warrants a fixes tag.
As this seems problem to go back to when this driver was added, perhaps this one:
Regardless, this looks good to me.
...
Greg Kroah-Hartman
maintainerQuoted 16 lines · Simon Horman
Quoted 8 lines · Greg Kroah-Hartman
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 <[email protected]>Assisted-by gkh_clanker_2000Signed-off-by Greg Kroah-Hartman <[email protected]>Hi Greg,
As a fix I think this warrants a fixes tag.
As this seems problem to go back to when this driver was added, perhaps this one:
Quoted 7 lines
Fixes d40261236e8e ("net/usb: Add Samsung Kalmia driver for Samsung GT-B3730")Regardless, this looks good to me.
Reviewed-by Simon Horman <[email protected]>...
Thanks for the review for this and the kaweth patch. And yes, I should have put a fixes tag there, but for stuff that's always been around, that's not really a big deal.
greg k-h
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 23 Feb 2026 13:59:26 +0100 you wrote:
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 <[email protected]>Assisted-by gkh_clanker_2000Signed-off-by Greg Kroah-Hartman <[email protected]>[...]
Here is the summary with links:
- net: usb: kalmia: validate USB endpoints
https://git.kernel.org/netdev/net/c/c58b6c29a4c9
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html