aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorUjjal Roy <royujjal@gmail.com>2013-11-05 18:01:45 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 13:57:01 -0500
commit88870d019e42cb9a9d594c77ea2bdd52e6a68361 (patch)
treeb6a8f9ee3bb922138bc2487e68e22bd1df47ff42 /drivers/net/wireless
parent0c17d9208119338ccb95d1b55ee74d7062928336 (diff)
mwifiex: fix wrong eth_hdr usage for bridged packets in AP mode
commit 8d93f1f309d38b65fce0b9f0de91ba6c96990c07 upstream. The eth_hdr is never defined in this driver but it gets compiled without any warning/error because kernel has defined eth_hdr. Fix it by defining our own p_ethhdr and use it instead of eth_hdr. Signed-off-by: Ujjal Roy <royujjal@gmail.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/mwifiex/uap_txrx.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c
index a018e42d117e..48e67247e8b1 100644
--- a/drivers/net/wireless/mwifiex/uap_txrx.c
+++ b/drivers/net/wireless/mwifiex/uap_txrx.c
@@ -34,6 +34,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
34 struct mwifiex_txinfo *tx_info; 34 struct mwifiex_txinfo *tx_info;
35 int hdr_chop; 35 int hdr_chop;
36 struct timeval tv; 36 struct timeval tv;
37 struct ethhdr *p_ethhdr;
37 u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 38 u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
38 39
39 uap_rx_pd = (struct uap_rxpd *)(skb->data); 40 uap_rx_pd = (struct uap_rxpd *)(skb->data);
@@ -48,14 +49,36 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
48 } 49 }
49 50
50 if (!memcmp(&rx_pkt_hdr->rfc1042_hdr, 51 if (!memcmp(&rx_pkt_hdr->rfc1042_hdr,
51 rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) 52 rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) {
53 /* Replace the 803 header and rfc1042 header (llc/snap) with
54 * an Ethernet II header, keep the src/dst and snap_type
55 * (ethertype).
56 *
57 * The firmware only passes up SNAP frames converting all RX
58 * data from 802.11 to 802.2/LLC/SNAP frames.
59 *
60 * To create the Ethernet II, just move the src, dst address
61 * right before the snap_type.
62 */
63 p_ethhdr = (struct ethhdr *)
64 ((u8 *)(&rx_pkt_hdr->eth803_hdr)
65 + sizeof(rx_pkt_hdr->eth803_hdr)
66 + sizeof(rx_pkt_hdr->rfc1042_hdr)
67 - sizeof(rx_pkt_hdr->eth803_hdr.h_dest)
68 - sizeof(rx_pkt_hdr->eth803_hdr.h_source)
69 - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type));
70 memcpy(p_ethhdr->h_source, rx_pkt_hdr->eth803_hdr.h_source,
71 sizeof(p_ethhdr->h_source));
72 memcpy(p_ethhdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest,
73 sizeof(p_ethhdr->h_dest));
52 /* Chop off the rxpd + the excess memory from 74 /* Chop off the rxpd + the excess memory from
53 * 802.2/llc/snap header that was removed. 75 * 802.2/llc/snap header that was removed.
54 */ 76 */
55 hdr_chop = (u8 *)eth_hdr - (u8 *)uap_rx_pd; 77 hdr_chop = (u8 *)p_ethhdr - (u8 *)uap_rx_pd;
56 else 78 } else {
57 /* Chop off the rxpd */ 79 /* Chop off the rxpd */
58 hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd; 80 hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd;
81 }
59 82
60 /* Chop off the leading header bytes so the it points 83 /* Chop off the leading header bytes so the it points
61 * to the start of either the reconstructed EthII frame 84 * to the start of either the reconstructed EthII frame