kernel_samsung_a53x/drivers/net
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
..
appletalk
arcnet
bonding Revert "net: bonding: correctly annotate RCU in bond_should_notify_peers()" 2024-11-24 00:23:56 +01:00
caif
can can: sun4i_can: sun4i_can_err(): fix {rx,tx}_errors statistics 2024-12-17 13:24:25 +01:00
dropdump
dsa Revert "net: dsa: mv88e6xxx: Limit chip-wide frame size config to CPU ports" 2024-11-24 00:23:56 +01:00
ethernet net: ethernet: fs_enet: Use %pa to format resource_size_t 2024-12-17 13:24:30 +01:00
fddi
fjes
hamradio
hippi
hyperv hv_netvsc: Fix VF namespace also in synthetic NIC NETDEV_REGISTER event 2024-11-23 23:22:01 +01:00
ieee802154 Revert "ieee802154: Fix build error" 2024-11-24 00:23:12 +01:00
ipa
ipvlan
mdio
netdevsim netdevsim: copy addresses for both in and out paths 2024-12-17 13:24:04 +01:00
pcs
phy net: phy: ti: take into account all possible interrupt sources 2024-11-30 02:33:27 +01:00
plip
ppp Revert "ppp: fix ppp_async_encode() illegal access" 2024-11-24 00:22:56 +01:00
slip Revert "slip: make slhc_remember() more robust against malicious packets" 2024-11-24 00:22:55 +01:00
team
usb net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration 2024-12-17 13:24:15 +01:00
vmxnet3
vxlan
wan
wimax
wireguard
wireless wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw() 2024-12-17 13:24:31 +01:00
xen-netback Revert "net/xen-netback: prevent UAF in xenvif_flush_hash()" 2024-11-24 00:23:10 +01:00
bareudp.c Revert "bareudp: Fix device stats updates." 2024-11-24 00:23:41 +01:00
dummy.c
eql.c
geneve.c geneve: do not assume mac header is set in geneve_xmit_skb() 2024-12-17 13:24:27 +01:00
gtp.c Revert "gtp: fix a potential NULL pointer dereference" 2024-11-24 00:23:49 +01:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c
veth.c
virtio_net.c Revert "virtio_net: Fix napi_skb_cache_put warning" 2024-11-24 00:23:46 +01:00
vrf.c Revert "net: vrf: determine the dst using the original ifindex for multicast" 2024-11-24 00:22:54 +01:00
vsockmon.c
xen-netfront.c