Commit dd95f22
wifi: ath9k: hif_usb: Fix use-after-free in ath9k_hif_usb_reg_in_cb()
It is possible that skb is freed in ath9k_htc_rx_msg(), then
usb_submit_urb() fails and we try to free skb again. It causes
use-after-free bug. Moreover, if alloc_skb() fails, urb->context becomes
NULL but rx_buf is not freed and there can be a memory leak.
The patch removes unnecessary nskb and makes skb processing more clear: it
is supposed that ath9k_htc_rx_msg() either frees old skb or passes its
managing to another callback function.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
Fixes: 3deff76 ("ath9k_htc: Increase URB count for REG_IN pipe")
Signed-off-by: Fedor Pchelkin <[email protected]>
Signed-off-by: Alexey Khoroshilov <[email protected]>
Acked-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]1 parent d174768 commit dd95f22
1 file changed
+15
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
711 | | - | |
712 | 711 | | |
713 | 712 | | |
714 | 713 | | |
715 | 714 | | |
716 | 715 | | |
717 | 716 | | |
718 | | - | |
| 717 | + | |
719 | 718 | | |
720 | 719 | | |
721 | 720 | | |
| |||
724 | 723 | | |
725 | 724 | | |
726 | 725 | | |
727 | | - | |
| 726 | + | |
728 | 727 | | |
729 | 728 | | |
730 | 729 | | |
| |||
735 | 734 | | |
736 | 735 | | |
737 | 736 | | |
738 | | - | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
739 | 742 | | |
740 | 743 | | |
741 | 744 | | |
742 | | - | |
743 | | - | |
744 | | - | |
| 745 | + | |
| 746 | + | |
745 | 747 | | |
746 | 748 | | |
747 | | - | |
748 | | - | |
| 749 | + | |
749 | 750 | | |
750 | 751 | | |
751 | | - | |
| 752 | + | |
752 | 753 | | |
753 | 754 | | |
754 | 755 | | |
755 | 756 | | |
756 | | - | |
| 757 | + | |
757 | 758 | | |
758 | 759 | | |
759 | 760 | | |
| |||
762 | 763 | | |
763 | 764 | | |
764 | 765 | | |
765 | | - | |
| 766 | + | |
766 | 767 | | |
767 | 768 | | |
768 | 769 | | |
769 | | - | |
| 770 | + | |
770 | 771 | | |
| 772 | + | |
771 | 773 | | |
772 | 774 | | |
773 | 775 | | |
| |||
0 commit comments