From: Tristan Madani brcmf_sdiod_skbuff_write() rounds skb->len up to the next 4-byte boundary and passes the larger size to sdio_memcpy_toio(). The 1-3 padding bytes beyond skb->data + skb->len are sent to the wireless device uninitialized. The SDPCM header carries the original (unpadded) frame length, so the device discards the padding. The window is therefore limited to the local SDIO bus. Ensure sufficient tailroom exists for the alignment padding before zeroing it. If the skb tailroom is too short, expand the head to make room. Fixes: 78b3f1c5be8f ("brcmfmac: replace brcmf_sdioh_request_buffer with brcmf_sdio_buffrw") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani --- Changes in v3: - Check skb_tailroom() before zeroing the padding; if the skb tailroom is too short, call pskb_expand_head() to make room (Arend van Spriel) - Use the correct Fixes tag: the 4-byte rounding was introduced by 78b3f1c5be8f, not by the later function split (Arend van Spriel) - Add impact note: SDPCM header carries unpadded length, so device discards the extra bytes and the window is local SDIO bus only (Arend van Spriel) Supersedes: f935e48bd9a6 ("wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary") Changes in v2: - Original submission as part of [PATCH wireless 1/2] series .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 71c2f99cdb711..e5068da9672cc 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -317,12 +317,23 @@ static int brcmf_sdiod_skbuff_write(struct brcmf_sdio_dev *sdiodev, struct sk_buff *skb) { unsigned int req_sz; + unsigned int pad; int err; /* Single skb use the standard mmc interface */ req_sz = skb->len + 3; req_sz &= (uint)~3; + pad = req_sz - skb->len; + if (pad > 0) { + if (skb_tailroom(skb) < pad) { + err = pskb_expand_head(skb, 0, pad, GFP_ATOMIC); + if (err) + return err; + } + memset(skb->data + skb->len, 0, pad); + } + err = sdio_memcpy_toio(func, addr, ((u8 *)(skb->data)), req_sz); if (err == -ENOMEDIUM) -- 2.47.3