]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: usb: pegasus: enable basic endpoint checking
authorZiyi Guo <n7l8m4@u.northwestern.edu>
Sun, 22 Feb 2026 05:06:33 +0000 (05:06 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 24 Feb 2026 10:51:51 +0000 (11:51 +0100)
commit3d7e6ce34f4fcc7083510c28b17a7c36462a25d4
treed16f9d803c5dd7e32785947abe33609f321e3187
parent983512f3a87fd8dc4c94dfa6b596b6e57df5aad7
net: usb: pegasus: enable basic endpoint checking

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@u.northwestern.edu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260222050633.410165-1-n7l8m4@u.northwestern.edu
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/usb/pegasus.c