* [PATCH] ath9k: fix an uninit value use in ath9k_htc_rx_msg()
@ 2022-08-25 8:05 Alexander Potapenko
2022-10-07 17:37 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Potapenko @ 2022-08-25 8:05 UTC (permalink / raw)
To: glider
Cc: ath9k-devel, davem, kuba, kvalo, linux-kernel, linux-wireless,
netdev, syzbot+2ca247c2d60c7023de7f
ath9k_htc_rx_msg() assumes skb->data contains a full
`struct htc_frame_hdr`, thus it needs a call to pskb_may_pull()
to ensure there is enough data.
This fixes a long-standing issue reported by KMSAN:
BUG: KMSAN: uninit-value in ath9k_htc_rx_msg+0x544/0x980 drivers/net/wireless/ath/ath9k/htc_hst.c:417
ath9k_htc_rx_msg+0x544/0x980 drivers/net/wireless/ath/ath9k/htc_hst.c:417
ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:653 [inline]
ath9k_hif_usb_rx_cb+0x196a/0x1f10 drivers/net/wireless/ath/ath9k/hif_usb.c:686
__usb_hcd_giveback_urb+0x522/0x740 drivers/usb/core/hcd.c:1670
usb_hcd_giveback_urb+0x150/0x620 drivers/usb/core/hcd.c:1747
dummy_timer+0xd3f/0x4f20 drivers/usb/gadget/udc/dummy_hcd.c:1988
call_timer_fn+0x43/0x480 kernel/time/timer.c:1474
expire_timers+0x272/0x610 kernel/time/timer.c:1519
__run_timers+0x5bc/0x8c0 kernel/time/timer.c:1790
...
Uninit was created at:
...
__alloc_skb+0x34a/0xd70 net/core/skbuff.c:426
__netdev_alloc_skb+0x126/0x780 net/core/skbuff.c:494
__dev_alloc_skb include/linux/skbuff.h:3264 [inline]
ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:635 [inline]
ath9k_hif_usb_rx_cb+0xe7b/0x1f10 drivers/net/wireless/ath/ath9k/hif_usb.c:686
__usb_hcd_giveback_urb+0x522/0x740 drivers/usb/core/hcd.c:1670
...
Reported-by: syzbot+2ca247c2d60c7023de7f@syzkaller.appspotmail.com
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Alexander Potapenko <glider@google.com>
---
drivers/net/wireless/ath/ath9k/htc_hst.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 994ec48b2f669..83a1d2fba2218 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -408,7 +408,8 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
struct htc_endpoint *endpoint;
__be16 *msg_id;
- if (!htc_handle || !skb)
+ if (!htc_handle || !skb ||
+ !pskb_may_pull(skb, sizeof(struct htc_frame_hdr)))
return;
htc_hdr = (struct htc_frame_hdr *) skb->data;
--
2.37.2.672.g94769d06f0-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ath9k: fix an uninit value use in ath9k_htc_rx_msg()
2022-08-25 8:05 [PATCH] ath9k: fix an uninit value use in ath9k_htc_rx_msg() Alexander Potapenko
@ 2022-10-07 17:37 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 2+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-10-07 17:37 UTC (permalink / raw)
To: Alexander Potapenko, glider
Cc: ath9k-devel, davem, kuba, kvalo, linux-kernel, linux-wireless,
netdev, syzbot+2ca247c2d60c7023de7f
Alexander Potapenko <glider@google.com> writes:
> ath9k_htc_rx_msg() assumes skb->data contains a full
> `struct htc_frame_hdr`, thus it needs a call to pskb_may_pull()
> to ensure there is enough data.
>
> This fixes a long-standing issue reported by KMSAN:
>
> BUG: KMSAN: uninit-value in ath9k_htc_rx_msg+0x544/0x980 drivers/net/wireless/ath/ath9k/htc_hst.c:417
> ath9k_htc_rx_msg+0x544/0x980 drivers/net/wireless/ath/ath9k/htc_hst.c:417
> ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:653 [inline]
> ath9k_hif_usb_rx_cb+0x196a/0x1f10 drivers/net/wireless/ath/ath9k/hif_usb.c:686
> __usb_hcd_giveback_urb+0x522/0x740 drivers/usb/core/hcd.c:1670
> usb_hcd_giveback_urb+0x150/0x620 drivers/usb/core/hcd.c:1747
> dummy_timer+0xd3f/0x4f20 drivers/usb/gadget/udc/dummy_hcd.c:1988
> call_timer_fn+0x43/0x480 kernel/time/timer.c:1474
> expire_timers+0x272/0x610 kernel/time/timer.c:1519
> __run_timers+0x5bc/0x8c0 kernel/time/timer.c:1790
> ...
>
> Uninit was created at:
> ...
> __alloc_skb+0x34a/0xd70 net/core/skbuff.c:426
> __netdev_alloc_skb+0x126/0x780 net/core/skbuff.c:494
> __dev_alloc_skb include/linux/skbuff.h:3264 [inline]
> ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:635 [inline]
> ath9k_hif_usb_rx_cb+0xe7b/0x1f10 drivers/net/wireless/ath/ath9k/hif_usb.c:686
> __usb_hcd_giveback_urb+0x522/0x740 drivers/usb/core/hcd.c:1670
> ...
>
> Reported-by: syzbot+2ca247c2d60c7023de7f@syzkaller.appspotmail.com
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> Signed-off-by: Alexander Potapenko <glider@google.com>
This has been fixed (in a different way) by commit:
b383e8abed41 ("wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg()")
-Toke
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-07 17:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 8:05 [PATCH] ath9k: fix an uninit value use in ath9k_htc_rx_msg() Alexander Potapenko
2022-10-07 17:37 ` Toke Høiland-Jørgensen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.