Commit ac7739b
net: usb: catc: enable basic endpoint checking
[ Upstream commit 9e7021d ]
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 90b7f29 ("net: usb: rtl8150: enable basic endpoint checking")
which fixed the issue in rtl8150.
Fixes: 1da177e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 4296a07 commit ac7739b
1 file changed
+31
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
772 | 782 | | |
773 | 783 | | |
774 | 784 | | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
775 | 792 | | |
776 | 793 | | |
777 | 794 | | |
| |||
784 | 801 | | |
785 | 802 | | |
786 | 803 | | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
787 | 812 | | |
788 | 813 | | |
789 | 814 | | |
| |||
828 | 853 | | |
829 | 854 | | |
830 | 855 | | |
831 | | - | |
832 | | - | |
| 856 | + | |
| 857 | + | |
833 | 858 | | |
834 | | - | |
835 | | - | |
| 859 | + | |
| 860 | + | |
836 | 861 | | |
837 | | - | |
838 | | - | |
| 862 | + | |
| 863 | + | |
839 | 864 | | |
840 | 865 | | |
841 | 866 | | |
| |||
0 commit comments