Commit 9cc4b7cb authored by James Hughes's avatar James Hughes Committed by Kalle Valo

brcmfmac: Make skb header writable before use

The driver was making changes to the skb_header without
ensuring it was writable (i.e. uncloned).
This patch also removes some boiler plate header size
checking/adjustment code as that is also handled by the
skb_cow_header function used to make header writable.
Signed-off-by: default avatarJames Hughes <james.hughes@raspberrypi.org>
Acked-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 455a1eb4
...@@ -210,22 +210,13 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ...@@ -210,22 +210,13 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
goto done; goto done;
} }
/* Make sure there's enough room for any header */ /* Make sure there's enough writable headroom*/
if (skb_headroom(skb) < drvr->hdrlen) { ret = skb_cow_head(skb, drvr->hdrlen);
struct sk_buff *skb2; if (ret < 0) {
brcmf_err("%s: skb_cow_head failed\n",
brcmf_dbg(INFO, "%s: insufficient headroom\n",
brcmf_ifname(ifp)); brcmf_ifname(ifp));
drvr->bus_if->tx_realloc++;
skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
dev_kfree_skb(skb); dev_kfree_skb(skb);
skb = skb2; goto done;
if (skb == NULL) {
brcmf_err("%s: skb_realloc_headroom failed\n",
brcmf_ifname(ifp));
ret = -ENOMEM;
goto done;
}
} }
/* validate length for ether packet */ /* validate length for ether packet */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment