Commit 355f16f
wifi: ath9k: hif_usb: Fix use-after-free in ath9k_hif_usb_reg_in_cb()
[ Upstream commit dd95f22 ]
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 <pchelkin@ispras.ru>
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20221008114917.21404-1-pchelkin@ispras.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent d856f75 commit 355f16f
1 file changed
+15
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | | - | |
713 | 712 | | |
714 | 713 | | |
715 | 714 | | |
716 | 715 | | |
717 | 716 | | |
718 | 717 | | |
719 | | - | |
| 718 | + | |
720 | 719 | | |
721 | 720 | | |
722 | 721 | | |
| |||
725 | 724 | | |
726 | 725 | | |
727 | 726 | | |
728 | | - | |
| 727 | + | |
729 | 728 | | |
730 | 729 | | |
731 | 730 | | |
| |||
736 | 735 | | |
737 | 736 | | |
738 | 737 | | |
739 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
740 | 743 | | |
741 | 744 | | |
742 | 745 | | |
743 | | - | |
744 | | - | |
745 | | - | |
| 746 | + | |
| 747 | + | |
746 | 748 | | |
747 | 749 | | |
748 | | - | |
749 | | - | |
| 750 | + | |
750 | 751 | | |
751 | 752 | | |
752 | | - | |
| 753 | + | |
753 | 754 | | |
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
757 | | - | |
| 758 | + | |
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
| |||
763 | 764 | | |
764 | 765 | | |
765 | 766 | | |
766 | | - | |
| 767 | + | |
767 | 768 | | |
768 | 769 | | |
769 | 770 | | |
770 | | - | |
| 771 | + | |
771 | 772 | | |
| 773 | + | |
772 | 774 | | |
773 | 775 | | |
774 | 776 | | |
| |||
0 commit comments