* [PATCH v2] brcmfmac: Ensure pointer correctly set if skb data location changes
@ 2017-04-24 11:40 James Hughes
[not found] ` <20170424114050.24948-1-james.hughes-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
2017-04-26 9:04 ` [v2] " Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: James Hughes @ 2017-04-24 11:40 UTC (permalink / raw)
To: Arend van Spriel, Franky Lin, Hante Meuleman, Kalle Valo,
linux-wireless, brcm80211-dev-list.pdl, netdev
Cc: James Hughes
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>
---
Changes in v2
Moved the assignment below the len check - saves a few cycles
if the length check fails.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 5eaac13e2317..9b7c19a508ac 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -198,7 +198,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, bsscfgidx=%d\n", ifp->bsscfgidx);
@@ -236,6 +236,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);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] brcmfmac: Ensure pointer correctly set if skb data location changes
[not found] ` <20170424114050.24948-1-james.hughes-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
@ 2017-04-25 7:56 ` Arend Van Spriel
0 siblings, 0 replies; 3+ messages in thread
From: Arend Van Spriel @ 2017-04-25 7:56 UTC (permalink / raw)
To: Kalle Valo
Cc: James Hughes, linux-wireless-u79uwXL29TY76Z2rM5mHXA,
brcm80211-dev-list.pdl-dY08KVG/lbpWk0Htik3J/w,
netdev-u79uwXL29TY76Z2rM5mHXA
On 24-4-2017 13:40, James Hughes wrote:
> 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.
Hi Kalle,
This one should go on 4.12 queue as well.
Thanks,
Arend
> Signed-off-by: James Hughes <james.hughes-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
>
> Acked-by: Arend van Spriel <arend.vanspriel-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> ---
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [v2] brcmfmac: Ensure pointer correctly set if skb data location changes
2017-04-24 11:40 [PATCH v2] brcmfmac: Ensure pointer correctly set if skb data location changes James Hughes
[not found] ` <20170424114050.24948-1-james.hughes-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
@ 2017-04-26 9:04 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-04-26 9:04 UTC (permalink / raw)
To: James Hughes
Cc: Arend van Spriel, Franky Lin, Hante Meuleman, linux-wireless,
brcm80211-dev-list.pdl, netdev, James Hughes
James Hughes <james.hughes@raspberrypi.org> wrote:
> 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>
Patch applied to wireless-drivers-next.git, thanks.
455a1eb4654c brcmfmac: Ensure pointer correctly set if skb data location changes
--
https://patchwork.kernel.org/patch/9696045/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-26 9:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-24 11:40 [PATCH v2] brcmfmac: Ensure pointer correctly set if skb data location changes James Hughes
[not found] ` <20170424114050.24948-1-james.hughes-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
2017-04-25 7:56 ` Arend Van Spriel
2017-04-26 9:04 ` [v2] " Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).