Commit 3d7e6ce
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 90b7f29 ("net: usb: rtl8150: enable basic endpoint checking")
- commit 9e7021d ("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>1 parent 983512f commit 3d7e6ce
1 file changed
Lines changed: 30 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
31 | 42 | | |
32 | 43 | | |
33 | 44 | | |
| |||
542 | 553 | | |
543 | 554 | | |
544 | 555 | | |
545 | | - | |
| 556 | + | |
546 | 557 | | |
547 | 558 | | |
548 | 559 | | |
| |||
582 | 593 | | |
583 | 594 | | |
584 | 595 | | |
585 | | - | |
| 596 | + | |
586 | 597 | | |
587 | 598 | | |
588 | 599 | | |
| |||
710 | 721 | | |
711 | 722 | | |
712 | 723 | | |
713 | | - | |
| 724 | + | |
714 | 725 | | |
715 | 726 | | |
716 | 727 | | |
| |||
837 | 848 | | |
838 | 849 | | |
839 | 850 | | |
840 | | - | |
| 851 | + | |
841 | 852 | | |
842 | 853 | | |
843 | 854 | | |
| |||
848 | 859 | | |
849 | 860 | | |
850 | 861 | | |
851 | | - | |
| 862 | + | |
852 | 863 | | |
853 | 864 | | |
854 | 865 | | |
| |||
1133 | 1144 | | |
1134 | 1145 | | |
1135 | 1146 | | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
1136 | 1154 | | |
1137 | 1155 | | |
1138 | 1156 | | |
1139 | 1157 | | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1140 | 1165 | | |
1141 | 1166 | | |
1142 | 1167 | | |
| |||
0 commit comments