Skip to content

Commit 58f36b4

Browse files
fooishbarKalle Valo
authored andcommitted
brcmfmac: Don't grow SKB by negative size
The commit to rework the headroom check in start_xmit() now calls pxskb_expand_head() unconditionally if the header is CoW. Unfortunately, it does so with the delta between the extant headroom and the header length, which may be negative if there is already sufficient headroom. pskb_expand_head() does allow for size being 0, in which case it just copies, so clamp the header delta to zero. Opening Chrome (and all my tabs) on a PCIE device was enough to reliably hit this. Fixes: 270a6c1 ("brcmfmac: rework headroom check in .start_xmit()") Signed-off-by: Daniel Stone <[email protected]> Cc: Arend Van Spriel <[email protected]> Cc: James Hughes <[email protected]> Cc: Hante Meuleman <[email protected]> Cc: Pieter-Paul Giesberts <[email protected]> Cc: Franky Lin <[email protected]> Tested-by: Hans de Goede <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent d755cbc commit 58f36b4

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+1
-1
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
214214

215215
/* Make sure there's enough writeable headroom */
216216
if (skb_headroom(skb) < drvr->hdrlen || skb_header_cloned(skb)) {
217-
head_delta = drvr->hdrlen - skb_headroom(skb);
217+
head_delta = max_t(int, drvr->hdrlen - skb_headroom(skb), 0);
218218

219219
brcmf_dbg(INFO, "%s: insufficient headroom (%d)\n",
220220
brcmf_ifname(ifp), head_delta);

0 commit comments

Comments
 (0)