public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: usb: kalmia: validate USB endpoints
@ 2026-02-23 12:59 Greg Kroah-Hartman
  2026-02-24  9:33 ` Simon Horman
  2026-02-26  3:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-23 12:59 UTC (permalink / raw)
  To: netdev; +Cc: linux-usb, linux-kernel, Greg Kroah-Hartman, stable

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>
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/usb/kalmia.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c
index 613fc6910f14..ee9c48f7f68f 100644
--- a/drivers/net/usb/kalmia.c
+++ b/drivers/net/usb/kalmia.c
@@ -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;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: usb: kalmia: validate USB endpoints
  2026-02-23 12:59 [PATCH] net: usb: kalmia: validate USB endpoints Greg Kroah-Hartman
@ 2026-02-24  9:33 ` Simon Horman
  2026-02-25 14:34   ` Greg Kroah-Hartman
  2026-02-26  3:10 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Horman @ 2026-02-24  9:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: netdev, linux-usb, linux-kernel, stable

On Mon, Feb 23, 2026 at 01:59:26PM +0100, Greg Kroah-Hartman 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 <stable@kernel.org>
> Assisted-by: gkh_clanker_2000
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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:

Fixes: d40261236e8e ("net/usb: Add Samsung Kalmia driver for Samsung GT-B3730")

Regardless, this looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: usb: kalmia: validate USB endpoints
  2026-02-24  9:33 ` Simon Horman
@ 2026-02-25 14:34   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-25 14:34 UTC (permalink / raw)
  To: Simon Horman; +Cc: netdev, linux-usb, linux-kernel, stable

On Tue, Feb 24, 2026 at 09:33:05AM +0000, Simon Horman wrote:
> On Mon, Feb 23, 2026 at 01:59:26PM +0100, Greg Kroah-Hartman 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 <stable@kernel.org>
> > Assisted-by: gkh_clanker_2000
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> 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:
> 
> Fixes: d40261236e8e ("net/usb: Add Samsung Kalmia driver for Samsung GT-B3730")
> 
> Regardless, this looks good to me.
> 
> Reviewed-by: Simon Horman <horms@kernel.org>
> ...
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: usb: kalmia: validate USB endpoints
  2026-02-23 12:59 [PATCH] net: usb: kalmia: validate USB endpoints Greg Kroah-Hartman
  2026-02-24  9:33 ` Simon Horman
@ 2026-02-26  3:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-26  3:10 UTC (permalink / raw)
  To: Greg KH; +Cc: netdev, linux-usb, linux-kernel, stable

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 <stable@kernel.org>
> Assisted-by: gkh_clanker_2000
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-26  3:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 12:59 [PATCH] net: usb: kalmia: validate USB endpoints Greg Kroah-Hartman
2026-02-24  9:33 ` Simon Horman
2026-02-25 14:34   ` Greg Kroah-Hartman
2026-02-26  3:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox