mwifiex: append each IE into a seperate IE buffer
authorStone Piao <piaoyun@marvell.com>
Wed, 26 Sep 2012 03:23:38 +0000 (20:23 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 28 Sep 2012 17:54:04 +0000 (13:54 -0400)
When scan is triggered from cfg80211, the request contains some IEs
and we should parse all the IEs and append each IE into a seperate
IE buffer.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cfg80211.c

index 261d7c548a5e6f02051b5175945423479f55217a..1f4bd67dffa7a8cd4c95819507f44723766e71b8 100644 (file)
@@ -1704,8 +1704,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 {
        struct net_device *dev = request->wdev->netdev;
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
-       int i;
+       int i, offset;
        struct ieee80211_channel *chan;
+       struct ieee_types_header *ie;
 
        wiphy_dbg(wiphy, "info: received scan request on %s\n", dev->name);
 
@@ -1728,13 +1729,17 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
        priv->user_scan_cfg->ssid_list = request->ssids;
 
        if (request->ie && request->ie_len) {
+               offset = 0;
                for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) {
                        if (priv->vs_ie[i].mask != MWIFIEX_VSIE_MASK_CLEAR)
                                continue;
                        priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_SCAN;
-                       memcpy(&priv->vs_ie[i].ie, request->ie,
-                              request->ie_len);
-                       break;
+                       ie = (struct ieee_types_header *)(request->ie + offset);
+                       memcpy(&priv->vs_ie[i].ie, ie, sizeof(*ie) + ie->len);
+                       offset += sizeof(*ie) + ie->len;
+
+                       if (offset >= request->ie_len)
+                               break;
                }
        }