c99e1334d41e00007bb66bc291136770e6717c3e
[openwrt/staging/ansuel.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Tue, 12 Sep 2023 10:28:00 +0200
3 Subject: [PATCH] net: ethernet: mtk_wed: check update_wo_rx_stats in
4 mtk_wed_update_rx_stats()
5
6 Check if update_wo_rx_stats function pointer is properly set in
7 mtk_wed_update_rx_stats routine before accessing it.
8
9 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10 Reviewed-by: Simon Horman <horms@kernel.org>
11 Link: https://lore.kernel.org/r/b0d233386e059bccb59f18f69afb79a7806e5ded.1694507226.git.lorenzo@kernel.org
12 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
13 ---
14
15 --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
16 +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
17 @@ -68,6 +68,9 @@ mtk_wed_update_rx_stats(struct mtk_wed_d
18 struct mtk_wed_wo_rx_stats *stats;
19 int i;
20
21 + if (!wed->wlan.update_wo_rx_stats)
22 + return;
23 +
24 if (count * sizeof(*stats) > skb->len - sizeof(u32))
25 return;
26