net: usb: catc: enable basic endpoint checking
authorZiyi Guo <n7l8m4@u.northwestern.edu>
Thu, 12 Feb 2026 21:41:54 +0000 (21:41 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 17 Feb 2026 10:53:36 +0000 (11:53 +0100)
commit9e7021d2aeae57c323a6f722ed7915686cdcc123
treeafa91d39fc7ed83712b2750797daff9acb9d46a3
parent94560267d6c41b1ff3fafbab726e3f8a55a6af34
net: usb: catc: enable basic endpoint checking

catc_probe() fills three URBs with hardcoded endpoint pipes without
verifying the endpoint descriptors:

  - usb_sndbulkpipe(usbdev, 1) and usb_rcvbulkpipe(usbdev, 1) for TX/RX
  - usb_rcvintpipe(usbdev, 2) for interrupt status

A malformed USB device can present these endpoints with transfer types
that differ from what the driver assumes.

Add a catc_usb_ep enum for endpoint numbers, replacing magic constants
throughout. Add usb_check_bulk_endpoints() and usb_check_int_endpoints()
calls after usb_set_interface() to verify endpoint types before use,
rejecting devices with mismatched descriptors at probe time.

Similar to
- commit 90b7f2961798 ("net: usb: rtl8150: enable basic endpoint checking")
which fixed the issue in rtl8150.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Suggested-by: Simon Horman <horms@kernel.org>
Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
Link: https://patch.msgid.link/20260212214154.3609844-1-n7l8m4@u.northwestern.edu
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/usb/catc.c