brcmfmac: Ensure pointer correctly set if skb data location changes
authorJames Hughes <james.hughes@raspberrypi.org>
Mon, 24 Apr 2017 11:40:50 +0000 (12:40 +0100)
committerSasha Levin <alexander.levin@verizon.com>
Tue, 13 Jun 2017 13:29:20 +0000 (09:29 -0400)
[ Upstream commit 455a1eb4654c24560eb9dfc634f29cba3d87601e ]

The incoming skb header may be resized if header space is
insufficient, which might change the data adddress in the skb.
Ensure that a cached pointer to that data is correctly set by
moving assignment to after any possible changes.

Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/net/wireless/brcm80211/brcmfmac/core.c

index f8f47dcfa886278caf5d694bc9d7a0eadadb8ccd..8071e7808c1d77b554ecabb8b8fb32d10758da9c 100644 (file)
@@ -192,7 +192,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
        int ret;
        struct brcmf_if *ifp = netdev_priv(ndev);
        struct brcmf_pub *drvr = ifp->drvr;
-       struct ethhdr *eh = (struct ethhdr *)(skb->data);
+       struct ethhdr *eh;
 
        brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx);
 
@@ -238,6 +238,8 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
                goto done;
        }
 
+       eh = (struct ethhdr *)(skb->data);
+
        if (eh->h_proto == htons(ETH_P_PAE))
                atomic_inc(&ifp->pend_8021x_cnt);