kernel_samsung_a53x/drivers/net/wireless
Norbert van Bolhuis ddb30ef2a9 wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()
[ Upstream commit 857282b819cbaa0675aaab1e7542e2c0579f52d7 ]

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>
2024-12-17 13:24:31 +01:00
..
admtek
ath wifi: ath5k: add PCI ID for Arcadyan devices 2024-12-17 13:24:30 +01:00
atmel
broadcom wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw() 2024-12-17 13:24:31 +01:00
cisco
cnss2
cnss_genl
cnss_prealloc
cnss_utils
intel wifi: ipw2x00: libipw_rx_any(): fix bad alignment 2024-12-17 13:24:31 +01:00
intersil wifi: p54: Use IRQF_NO_AUTOEN flag in request_irq() 2024-12-17 13:24:03 +01:00
marvell wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_config_scan() 2024-12-17 13:24:05 +01:00
mediatek Revert "wifi: mt76: mt7915: fix rx filter setting for bfee functionality" 2024-11-24 00:23:30 +01:00
microchip Revert "wifi: wilc1000: fix potential RCU dereference issue in wilc_parse_join_bss_param" 2024-11-24 00:23:30 +01:00
qualcomm/qca6490
quantenna
ralink
realtek Revert "wifi: rtw88: always wait for both firmware loading attempts" 2024-11-24 00:23:31 +01:00
rsi
scsc
st Revert "wifi: cw1200: Avoid processing an invalid TIM IE" 2024-11-24 00:23:53 +01:00
ti
zydas
Kconfig
mac80211_hwsim.c
mac80211_hwsim.h
Makefile
ray_cs.c
ray_cs.h
rayctl.h
rndis_wlan.c
virt_wifi.c Revert "wifi: virt_wifi: avoid reporting connection success with wrong SSID" 2024-11-24 00:23:56 +01:00
wl3501.h
wl3501_cs.c