Skip to contentSkip to conversation

wifi: brcmfmac: fix scatter-gather handling by detecting end of sg list

PATCH In review [email protected] 2 participants 2 messages Nov 8, 2024 – Dec 9, 2024 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: brcmfmac: fix scatter-gather handling by detecting end of sg list

From: Norbert van Bolhuis <[email protected]>

The scatter-gather handling uses a pre-allocated list (with nents entries). If the driver runs out of sg entries it will result in an oops. Let's detect this instead and make the SDIO block transfer fail.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +5 -0
index 42d991d9f8cb..60eb95fc19a5 100644
@@ -455,6 +455,11 @@ static int brcmf_sdiod_sglist_rw(struct brcmf_sdio_dev *sdiodev,
 			if (sg_data_sz > max_req_sz - req_sz)
 				sg_data_sz = max_req_sz - req_sz;
 
+			if (!sgl) {
+				/* out of (pre-allocated) scatterlist entries */
+				ret = -ENOMEM;
+				goto exit;
+			}
 			sg_set_buf(sgl, pkt_data, sg_data_sz);
 			sg_cnt++;
 
Signature · 1 line
2.42.0
#1 lore raw
Quoted 7 lines · [email protected] wrote:

From: Norbert van Bolhuis <[email protected]>

The scatter-gather handling uses a pre-allocated list (with nents entries). If the driver runs out of sg entries it will result in an oops. Let's detect this instead and make the SDIO block transfer fail.

Patch applied to wireless-next.git, thanks.

52e8726d6782 wifi: brcmfmac: fix scatter-gather handling by detecting end of sg list

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches