2fc7c409a8e2b283ae79ab0123c67c3c566b371d
[oweals/openwrt.git] /
1 From 455a1eb4654c24560eb9dfc634f29cba3d87601e Mon Sep 17 00:00:00 2001
2 From: James Hughes <james.hughes@raspberrypi.org>
3 Date: Mon, 24 Apr 2017 12:40:50 +0100
4 Subject: [PATCH] brcmfmac: Ensure pointer correctly set if skb data location
5  changes
6
7 The incoming skb header may be resized if header space is
8 insufficient, which might change the data adddress in the skb.
9 Ensure that a cached pointer to that data is correctly set by
10 moving assignment to after any possible changes.
11
12 Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
13
14 Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
16 ---
17  drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +++-
18  1 file changed, 3 insertions(+), 1 deletion(-)
19
20 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
21 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
22 @@ -198,7 +198,7 @@ static netdev_tx_t brcmf_netdev_start_xm
23         int ret;
24         struct brcmf_if *ifp = netdev_priv(ndev);
25         struct brcmf_pub *drvr = ifp->drvr;
26 -       struct ethhdr *eh = (struct ethhdr *)(skb->data);
27 +       struct ethhdr *eh;
28  
29         brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
30  
31 @@ -236,6 +236,8 @@ static netdev_tx_t brcmf_netdev_start_xm
32                 goto done;
33         }
34  
35 +       eh = (struct ethhdr *)(skb->data);
36 +
37         if (eh->h_proto == htons(ETH_P_PAE))
38                 atomic_inc(&ifp->pend_8021x_cnt);
39