Skip to contentSkip to conversation

brcmfmac: Don't grow SKB by negative size

PATCH Superseded Daniel Stone 1 participant 1 message Jul 26, 2017 Broadcom BRCM80211 IEEE802.11 wireless drivers

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 270a6c1f65fe ("brcmfmac: rework headroom check in .start_xmit()")
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]>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi,
It would be great to get this in to 4.13. Otherwise, just opening Chrome is enough to take my machine down in ~5 seconds.

Cheers,
Daniel

drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +1 -1
index 2153e8062b4c..ee91a411918c 100644
@@ -214,7 +214,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
 
 	/* Make sure there's enough writeable headroom */
 	if (skb_headroom(skb) < drvr->hdrlen || skb_header_cloned(skb)) {
-		head_delta = drvr->hdrlen - skb_headroom(skb);
+		head_delta = min(drvr->hdrlen - skb_headroom(skb), 0);
 
 		brcmf_dbg(INFO, "%s: insufficient headroom (%d)\n",
 			  brcmf_ifname(ifp), head_delta);
Signature · 1 line
2.13.2