319-v4.12-0052-brcmfmac-Make-skb-header-writable-before-use.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 9cc4b7cb86cbcc6330a3faa8cd65268cd2d3c227 Mon Sep 17 00:00:00 2001
  2. From: James Hughes <james.hughes@raspberrypi.org>
  3. Date: Tue, 25 Apr 2017 10:15:06 +0100
  4. Subject: [PATCH] brcmfmac: Make skb header writable before use
  5. The driver was making changes to the skb_header without
  6. ensuring it was writable (i.e. uncloned).
  7. This patch also removes some boiler plate header size
  8. checking/adjustment code as that is also handled by the
  9. skb_cow_header function used to make header writable.
  10. Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
  11. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  12. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13. ---
  14. .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 19 +++++--------------
  15. 1 file changed, 5 insertions(+), 14 deletions(-)
  16. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18. @@ -210,22 +210,13 @@ static netdev_tx_t brcmf_netdev_start_xm
  19. goto done;
  20. }
  21. - /* Make sure there's enough room for any header */
  22. - if (skb_headroom(skb) < drvr->hdrlen) {
  23. - struct sk_buff *skb2;
  24. -
  25. - brcmf_dbg(INFO, "%s: insufficient headroom\n",
  26. + /* Make sure there's enough writable headroom*/
  27. + ret = skb_cow_head(skb, drvr->hdrlen);
  28. + if (ret < 0) {
  29. + brcmf_err("%s: skb_cow_head failed\n",
  30. brcmf_ifname(ifp));
  31. - drvr->bus_if->tx_realloc++;
  32. - skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
  33. dev_kfree_skb(skb);
  34. - skb = skb2;
  35. - if (skb == NULL) {
  36. - brcmf_err("%s: skb_realloc_headroom failed\n",
  37. - brcmf_ifname(ifp));
  38. - ret = -ENOMEM;
  39. - goto done;
  40. - }
  41. + goto done;
  42. }
  43. /* validate length for ether packet */