Re: [PATCH net] net: usb: pegasus: enable basic endpoint checking
From: Simon Horman
Date: Mon Feb 23 2026 - 14:53:40 EST
On Sun, Feb 22, 2026 at 05:06:33AM +0000, Ziyi Guo wrote:
> pegasus_probe() fills URBs with hardcoded endpoint pipes without
> verifying the endpoint descriptors:
>
> - usb_rcvbulkpipe(dev, 1) for RX data
> - usb_sndbulkpipe(dev, 2) for TX data
> - usb_rcvintpipe(dev, 3) for status interrupts
>
> A malformed USB device can present these endpoints with transfer types
> that differ from what the driver assumes.
>
> Add a pegasus_usb_ep enum for endpoint numbers, replacing magic
> constants throughout. Add usb_check_bulk_endpoints() and
> usb_check_int_endpoints() calls before any resource allocation to
> verify endpoint types before use, rejecting devices with mismatched
> descriptors at probe time, and avoid triggering assertion.
>
> Similar fix to
> - commit 90b7f2961798 ("net: usb: rtl8150: enable basic endpoint checking")
> - commit 9e7021d2aeae ("net: usb: catc: enable basic endpoint checking")
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Ziyi Guo <n7l8m4@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>