linux/drivers/net/wireless
Norbert van Bolhuis 34941321b5 wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()
[ Upstream commit 857282b819 ]

This patch fixes a NULL pointer dereference bug in brcmfmac that occurs
when a high 'sd_sgentry_align' value applies (e.g. 512) and a lot of queued SKBs
are sent from the pkt queue.

The problem is the number of entries in the pre-allocated sgtable, it is
nents = max(rxglom_size, txglom_size) + max(rxglom_size, txglom_size) >> 4 + 1.
Given the default [rt]xglom_size=32 it's actually 35 which is too small.
Worst case, the pkt queue can end up with 64 SKBs. This occurs when a new SKB
is added for each original SKB if tailroom isn't enough to hold tail_pad.
At least one sg entry is needed for each SKB. So, eventually the "skb_queue_walk loop"
in brcmf_sdiod_sglist_rw may run out of sg entries. This makes sg_next return
NULL and this causes the oops.

The patch sets nents to max(rxglom_size, txglom_size) * 2 to be able handle
the worst-case.
Btw. this requires only 64-35=29 * 16 (or 20 if CONFIG_NEED_SG_DMA_LENGTH) = 464
additional bytes of memory.

Signed-off-by: Norbert van Bolhuis <nvbolhuis@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241107132903.13513-1-nvbolhuis@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-12-14 20:03:54 +01:00
..
admtek wifi: mac80211: inform the low level if drv_stop() is a suspend 2024-06-26 10:25:46 +02:00
ath wifi: ath5k: add PCI ID for Arcadyan devices 2024-12-14 20:03:48 +01:00
atmel wifi: mac80211: inform the low level if drv_stop() is a suspend 2024-06-26 10:25:46 +02:00
broadcom wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw() 2024-12-14 20:03:54 +01:00
intel wifi: ipw2x00: libipw_rx_any(): fix bad alignment 2024-12-14 20:03:54 +01:00
intersil wifi: p54: Use IRQF_NO_AUTOEN flag in request_irq() 2024-12-05 14:01:37 +01:00
marvell wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_config_scan() 2024-12-05 14:01:45 +01:00
mediatek wireless fixes for v6.12-rc5 2024-10-25 10:44:41 +01:00
microchip wifi: wilc1000: Set MAC after operation mode 2024-12-05 14:01:45 +01:00
purelifi move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
quantenna wifi: cfg80211: handle DFS per link 2024-09-06 13:01:05 +02:00
ralink wifi: mac80211: inform the low level if drv_stop() is a suspend 2024-06-26 10:25:46 +02:00
realtek wifi: rtw89: check return value of ieee80211_probereq_get() for RNR 2024-12-14 20:03:43 +01:00
rsi wifi: rsi: Remove an unused field in struct rsi_debugfs 2024-09-09 15:30:49 +03:00
silabs wifi: wfx: Fix error handling in wfx_core_init() 2024-12-05 14:01:51 +01:00
st wifi: cw1200: Fix potential NULL dereference 2024-12-05 14:01:51 +01:00
ti wifi: mac80211: handle ieee80211_radar_detected() for MLO 2024-09-06 13:01:05 +02:00
virtual wifi: radiotap: Avoid -Wflex-array-member-not-at-end warnings 2024-10-08 21:24:20 +02:00
zydas move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
Kconfig wifi: remove orphaned rndis_wlan driver 2023-10-30 19:30:33 +02:00
Makefile wifi: remove orphaned rndis_wlan driver 2023-10-30 19:30:33 +02:00