1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/wireless
Hans de Goede 16e455a465 wifi: brcmfmac: Fix field-spanning write in brcmf_scan_params_v2_to_v1()
Using brcmfmac with 6.5-rc3 on a brcmfmac43241b4-sdio triggers
a backtrace caused by the following field-spanning warning:

memcpy: detected field-spanning write (size 120) of single field
  "&params_le->channel_list[0]" at
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1072 (size 2)

The driver still works after this warning. The warning was introduced by the
new field-spanning write checks which were enabled recently.

Fix this by replacing the channel_list[1] declaration at the end of
the struct with a flexible array declaration.

Most users of struct brcmf_scan_params_le calculate the size to alloc
using the size of the non flex-array part of the struct + needed extra
space, so they do not care about sizeof(struct brcmf_scan_params_le).

brcmf_notify_escan_complete() however uses the struct on the stack,
expecting there to be room for at least 1 entry in the channel-list
to store the special -1 abort channel-id.

To make this work use an anonymous union with a padding member
added + the actual channel_list flexible array.

Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230729140500.27892-1-hdegoede@redhat.com
2023-08-02 13:34:16 +03:00
..
admtek wifi: mac80211: add wake_tx_queue callback to drivers 2022-10-10 11:00:03 +02:00
ath Revert "wifi: ath6k: silence false positive -Wno-dangling-pointer warning on GCC 12" 2023-07-26 10:09:28 +03:00
atmel wifi: atmel: Fix an error handling path in atmel_probe() 2023-05-25 19:16:15 +03:00
broadcom wifi: brcmfmac: Fix field-spanning write in brcmf_scan_params_v2_to_v1() 2023-08-02 13:34:16 +03:00
cisco wifi: airo: avoid uninitialized warning in airo_get_rate() 2023-07-11 19:22:54 -07:00
intel wifi: iwlwifi: remove 'use_tfh' config to fix crash 2023-07-11 20:26:06 -07:00
intersil wifi: p54: Add missing MODULE_FIRMWARE macro 2023-06-21 12:53:30 +03:00
legacy wifi: ray_cs: Replace 1-element array with flexible array 2023-08-01 16:40:13 +03:00
marvell Networking changes for 6.5. 2023-06-28 16:43:10 -07:00
mediatek wifi: mt76: mt7615: do not advertise 5 GHz on first phy of MT7615D (DBDC) 2023-07-24 16:32:14 +03:00
microchip wifi: wilc1000: Increase ASSOC response buffer 2023-05-11 15:53:44 +03:00
purelifi wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx() 2022-11-28 15:56:17 +02:00
quantenna wifi: qtnfmac: use struct_size and size_sub for payload length 2023-03-13 15:44:29 +02:00
ralink wifi: rt2x00: fix the typo in comments 2023-06-15 10:46:08 +03:00
realtek wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set() 2023-07-12 17:52:37 -07:00
rsi wifi: rsi: Do not set MMC_PM_KEEP_POWER in shutdown 2023-06-08 19:02:14 +03:00
silabs spi: Updates for v6.4 2023-04-27 11:02:26 -07:00
st net: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:02 +00:00
ti net: Use of_property_read_bool() for boolean properties 2023-03-16 17:41:28 +00:00
virtual wifi: mac80211_hwsim: Don't access vif valid links directly 2023-06-14 12:20:08 +02:00
zydas wifi: zd1211rw: remove redundant decls 2023-02-13 19:25:47 +02:00
Kconfig wifi: move raycs, wl3501 and rndis_wlan to legacy directory 2023-03-13 15:42:14 +02:00
Makefile wifi: move raycs, wl3501 and rndis_wlan to legacy directory 2023-03-13 15:42:14 +02:00