Commit 968b098
can: esd_usb: add endpoint type validation
esd_usb_probe() constructs bulk pipes for two endpoints without
verifying their transfer types:
- usb_rcvbulkpipe(dev->udev, 1) for RX (version reply, async RX data)
- usb_sndbulkpipe(dev->udev, 2) for TX (version query, CAN frames)
A malformed USB device can present these endpoints with transfer types
that differ from what the driver assumes, triggering the WARNING in
usb_submit_urb().
Use usb_find_common_endpoints() to discover and validate the first
bulk IN and bulk OUT endpoints at probe time, before any allocation.
Found pipes are saved to struct esd_usb and code uses them directly
instead of making pipes in place.
Similar to
- commit 136bed0 ("can: mcba_usb: properly check endpoint type")
which established the usb_find_common_endpoints() + stored pipes
pattern for CAN USB drivers.
Fixes: 96d8e90 ("can: Add driver for esd CAN-USB/2 device")
Suggested-by: Vincent Mailhol <mailhol@kernel.org>
Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
Link: https://patch.msgid.link/20260213203927.599163-1-n7l8m4@u.northwestern.edu
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>1 parent ab3f894 commit 968b098
1 file changed
Lines changed: 17 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
275 | 278 | | |
276 | 279 | | |
277 | 280 | | |
| |||
537 | 540 | | |
538 | 541 | | |
539 | 542 | | |
540 | | - | |
| 543 | + | |
541 | 544 | | |
542 | 545 | | |
543 | 546 | | |
| |||
626 | 629 | | |
627 | 630 | | |
628 | 631 | | |
629 | | - | |
630 | | - | |
631 | | - | |
| 632 | + | |
632 | 633 | | |
633 | 634 | | |
634 | 635 | | |
| |||
639 | 640 | | |
640 | 641 | | |
641 | 642 | | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
| 643 | + | |
| 644 | + | |
648 | 645 | | |
649 | 646 | | |
650 | 647 | | |
| |||
677 | 674 | | |
678 | 675 | | |
679 | 676 | | |
680 | | - | |
681 | | - | |
| 677 | + | |
682 | 678 | | |
683 | 679 | | |
684 | 680 | | |
| |||
903 | 899 | | |
904 | 900 | | |
905 | 901 | | |
906 | | - | |
| 902 | + | |
907 | 903 | | |
908 | 904 | | |
909 | 905 | | |
| |||
1298 | 1294 | | |
1299 | 1295 | | |
1300 | 1296 | | |
| 1297 | + | |
1301 | 1298 | | |
1302 | 1299 | | |
1303 | 1300 | | |
1304 | 1301 | | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
1305 | 1307 | | |
1306 | 1308 | | |
1307 | 1309 | | |
1308 | 1310 | | |
1309 | 1311 | | |
1310 | 1312 | | |
1311 | 1313 | | |
| 1314 | + | |
| 1315 | + | |
1312 | 1316 | | |
1313 | 1317 | | |
1314 | 1318 | | |
| |||
0 commit comments