Commit 35854ed
net: usb: pegasus: enable basic endpoint checking
[ Upstream commit 3d7e6ce ]
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 90b7f29 ("net: usb: rtl8150: enable basic endpoint checking")
- commit 9e7021d ("net: usb: catc: enable basic endpoint checking")
Fixes: 1da177e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent df001db commit 35854ed
1 file changed
+30
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
34 | 45 | | |
35 | 46 | | |
36 | 47 | | |
| |||
545 | 556 | | |
546 | 557 | | |
547 | 558 | | |
548 | | - | |
| 559 | + | |
549 | 560 | | |
550 | 561 | | |
551 | 562 | | |
| |||
585 | 596 | | |
586 | 597 | | |
587 | 598 | | |
588 | | - | |
| 599 | + | |
589 | 600 | | |
590 | 601 | | |
591 | 602 | | |
| |||
713 | 724 | | |
714 | 725 | | |
715 | 726 | | |
716 | | - | |
| 727 | + | |
717 | 728 | | |
718 | 729 | | |
719 | 730 | | |
| |||
840 | 851 | | |
841 | 852 | | |
842 | 853 | | |
843 | | - | |
| 854 | + | |
844 | 855 | | |
845 | 856 | | |
846 | 857 | | |
| |||
851 | 862 | | |
852 | 863 | | |
853 | 864 | | |
854 | | - | |
| 865 | + | |
855 | 866 | | |
856 | 867 | | |
857 | 868 | | |
| |||
1136 | 1147 | | |
1137 | 1148 | | |
1138 | 1149 | | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1139 | 1157 | | |
1140 | 1158 | | |
1141 | 1159 | | |
1142 | 1160 | | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
1143 | 1168 | | |
1144 | 1169 | | |
1145 | 1170 | | |
| |||
0 commit comments