linux/drivers/net/wireless/st/cw1200
Tianchu Chen 7c16117808 wifi: cw1200: fix TX padding OOB read leaking heap data to device
The TX path rounds the transfer size up to the bus alignment
(align_size(), up to 511 bytes for SDIO, 1 byte for SPI) but sends
the padded length straight from the frame buffer, which has no room
reserved for the padding.  cw1200_data_write() therefore reads past
the end of the frame and the bus transfer carries those bytes to the
device.  A bogus device can collect up to 511 bytes of kernel heap
data per TX frame.

The RX path does not have this problem: it allocates the skb with
the aligned length (alloc_len) before reading.

Compute the exact padding with the bus align_size() callback, make
sure queued TX frames have tailroom for it, and zero the padding
bytes before the transfer so nothing past the frame is exposed.

This is not expected to change driver behavior on most cases: frame
contents and transfer sizes are unchanged, only the content of the
padding bytes (previously undefined stale memory, now zero), which
the device never reads since the WSM header carries the real frame
length.  The skb expansion can only fail under memory exhaustion,
in which case the frame is dropped like on the existing error paths
of cw1200_tx().

Discovered by Atuin - Automated Vulnerability Discovery Engine.

Fixes: a910e4a94f ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Tianchu Chen <flynnnchen@tencent.com>
Link: https://patch.msgid.link/7982b4a7e64f74e2068790ec389ca680a081f730@linux.dev
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-21 14:37:36 +02:00
..
bh.c wifi: cw1200: fix TX padding OOB read leaking heap data to device 2026-09-21 14:37:36 +02:00
bh.h
cw1200_sdio.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cw1200_spi.c wifi: cw1200: Fix potential NULL dereference 2024-12-18 19:58:27 +02:00
cw1200.h
debug.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
debug.h
fwio.c
fwio.h
hwbus.h
hwio.c
hwio.h
Kconfig
main.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
Makefile
pm.c wifi: cw1200: Revert "Fix locking in error paths" 2026-05-04 09:08:24 +02:00
pm.h
queue.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
queue.h wifi: cw1200: Remove unused cw1200_queue_requeue_all() 2024-10-17 19:50:41 +03:00
scan.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
scan.h
sta.c wifi: cw1200: cap SSID length in cw1200_do_join() 2025-09-03 09:37:51 +02:00
sta.h wifi: cfg80211/mac80211: Add support to get radio index 2025-06-24 15:19:27 +02:00
txrx.c wifi: cw1200: fix TX padding OOB read leaking heap data to device 2026-09-21 14:37:36 +02:00
txrx.h
wsm.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
wsm.h