Commit 47b2116
usb: gadget: f_acm: Refactor bind path to use __free()
After an bind/unbind cycle, the acm->notify_req is left stale. If a
subsequent bind fails, the unified error label attempts to free this
stale request, leading to a NULL pointer dereference when accessing
ep->ops->free_request.
Refactor the error handling in the bind path to use the __free()
automatic cleanup mechanism.
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
Call trace:
usb_ep_free_request+0x2c/0xec
gs_free_req+0x30/0x44
acm_bind+0x1b8/0x1f4
usb_add_function+0xcc/0x1f0
configfs_composite_bind+0x468/0x588
gadget_bind_driver+0x104/0x270
really_probe+0x190/0x374
__driver_probe_device+0xa0/0x12c
driver_probe_device+0x3c/0x218
__device_attach_driver+0x14c/0x188
bus_for_each_drv+0x10c/0x168
__device_attach+0xfc/0x198
device_initial_probe+0x14/0x24
bus_probe_device+0x94/0x11c
device_add+0x268/0x48c
usb_add_gadget+0x198/0x28c
dwc3_gadget_init+0x700/0x858
__dwc3_set_mode+0x3cc/0x664
process_scheduled_works+0x1d8/0x488
worker_thread+0x244/0x334
kthread+0x114/0x1bc
ret_from_fork+0x10/0x20
Fixes: 1f1ba11 ("usb gadget: issue notifications from ACM function")
Cc: stable@kernel.org
Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Link: https://lore.kernel.org/r/20250916-ready-v1-4-4997bf277548@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250916-ready-v1-4-4997bf277548@google.com1 parent 75a5b8d commit 47b2116
1 file changed
Lines changed: 19 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
613 | 616 | | |
614 | 617 | | |
615 | 618 | | |
| 619 | + | |
616 | 620 | | |
617 | 621 | | |
618 | 622 | | |
| |||
630 | 634 | | |
631 | 635 | | |
632 | 636 | | |
633 | | - | |
| 637 | + | |
634 | 638 | | |
635 | 639 | | |
636 | 640 | | |
| |||
639 | 643 | | |
640 | 644 | | |
641 | 645 | | |
642 | | - | |
| 646 | + | |
643 | 647 | | |
644 | 648 | | |
645 | 649 | | |
646 | 650 | | |
647 | 651 | | |
648 | 652 | | |
649 | | - | |
650 | | - | |
651 | 653 | | |
652 | 654 | | |
653 | 655 | | |
654 | | - | |
| 656 | + | |
655 | 657 | | |
656 | 658 | | |
657 | 659 | | |
658 | 660 | | |
659 | | - | |
| 661 | + | |
660 | 662 | | |
661 | 663 | | |
662 | 664 | | |
663 | 665 | | |
664 | | - | |
| 666 | + | |
665 | 667 | | |
666 | 668 | | |
667 | 669 | | |
668 | 670 | | |
669 | 671 | | |
670 | 672 | | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
676 | 678 | | |
677 | | - | |
678 | | - | |
| 679 | + | |
| 680 | + | |
679 | 681 | | |
680 | 682 | | |
681 | 683 | | |
| |||
692 | 694 | | |
693 | 695 | | |
694 | 696 | | |
695 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
696 | 700 | | |
697 | 701 | | |
698 | 702 | | |
699 | 703 | | |
700 | 704 | | |
701 | 705 | | |
702 | 706 | | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | 707 | | |
712 | 708 | | |
713 | 709 | | |
| |||
0 commit comments