231-2-brcmfmac-fix-use-of-skb-ctrlbuf-in-SDIO.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. From 3eee5fd6d045dc744f98fd684258e3fdfa667fd6 Mon Sep 17 00:00:00 2001
  2. From: Arend van Spriel <arend@broadcom.com>
  3. Date: Tue, 25 Feb 2014 20:30:27 +0100
  4. Subject: [PATCH] brcmfmac: fix use of skb control buffer in SDIO driver part
  5. The SDIO driver has a 16-bit field defined in the skbuff control buffer.
  6. However, it is accessed as a u32 overwriting other control info. Another
  7. issue is that the field is not initialized for networking packets, but
  8. the control buffer content is unspecified as other networking layers can
  9. use it.
  10. Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11. Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12. Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14. Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15. Signed-off-by: John W. Linville <linville@tuxdriver.com>
  16. ---
  17. drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 10 ++++++----
  18. 1 file changed, 6 insertions(+), 4 deletions(-)
  19. --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
  20. +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
  21. @@ -1955,7 +1955,7 @@ static int brcmf_sdio_txpkt_prep_sg(stru
  22. memcpy(pkt_pad->data,
  23. pkt->data + pkt->len - tail_chop,
  24. tail_chop);
  25. - *(u32 *)(pkt_pad->cb) = ALIGN_SKB_FLAG + tail_chop;
  26. + *(u16 *)(pkt_pad->cb) = ALIGN_SKB_FLAG + tail_chop;
  27. skb_trim(pkt, pkt->len - tail_chop);
  28. skb_trim(pkt_pad, tail_pad + tail_chop);
  29. __skb_queue_after(pktq, pkt, pkt_pad);
  30. @@ -2003,7 +2003,7 @@ brcmf_sdio_txpkt_prep(struct brcmf_sdio
  31. * already properly aligned and does not
  32. * need an sdpcm header.
  33. */
  34. - if (*(u32 *)(pkt_next->cb) & ALIGN_SKB_FLAG)
  35. + if (*(u16 *)(pkt_next->cb) & ALIGN_SKB_FLAG)
  36. continue;
  37. /* align packet data pointer */
  38. @@ -2067,11 +2067,11 @@ brcmf_sdio_txpkt_postp(struct brcmf_sdio
  39. u8 *hdr;
  40. u32 dat_offset;
  41. u16 tail_pad;
  42. - u32 dummy_flags, chop_len;
  43. + u16 dummy_flags, chop_len;
  44. struct sk_buff *pkt_next, *tmp, *pkt_prev;
  45. skb_queue_walk_safe(pktq, pkt_next, tmp) {
  46. - dummy_flags = *(u32 *)(pkt_next->cb);
  47. + dummy_flags = *(u16 *)(pkt_next->cb);
  48. if (dummy_flags & ALIGN_SKB_FLAG) {
  49. chop_len = dummy_flags & ALIGN_SKB_CHOP_LEN_MASK;
  50. if (chop_len) {
  51. @@ -2554,6 +2554,8 @@ static int brcmf_sdio_bus_txdata(struct
  52. /* Priority based enq */
  53. spin_lock_irqsave(&bus->txqlock, flags);
  54. + /* reset bus_flags in packet cb */
  55. + *(u16 *)(pkt->cb) = 0;
  56. if (!brcmf_c_prec_enq(bus->sdiodev->dev, &bus->txq, pkt, prec)) {
  57. skb_pull(pkt, bus->tx_hdrlen);
  58. brcmf_err("out of bus->txq !!!\n");