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

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.

Signed-off-by: Norbert van Bolhuis <nvbolhuis@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241108125609.107016-1-nvbolhuis@gmail.com
This commit is contained in:
Norbert van Bolhuis 2024-11-08 13:52:30 +01:00 committed by Kalle Valo
parent b81e0211e9
commit 52e8726d67

View File

@ -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++;