diff options
author | Arend van Spriel <arend@broadcom.com> | 2011-10-12 14:51:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-10-14 14:48:17 -0400 |
commit | 40c8e95af02d29a488d6a6b127f562d9210e6005 (patch) | |
tree | 1b3d5c2fea3ddd5fafbb1b6820b03d4d2ea27efb /drivers/net | |
parent | 668310754f32b6c0a421361a3e45767a4b5f5c05 (diff) |
brcm80211: use endian annotation for pmk related structure
The pairwise master key configuration is sent to the device. The
structure has been annotated for endianess checking.
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 34 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/include/brcmu_wifi.h | 2 |
2 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 1218ed755e80..9e69cd725d59 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -2467,9 +2467,12 @@ brcmf_update_pmklist(struct net_device *ndev, | |||
2467 | struct brcmf_cfg80211_pmk_list *pmk_list, s32 err) | 2467 | struct brcmf_cfg80211_pmk_list *pmk_list, s32 err) |
2468 | { | 2468 | { |
2469 | int i, j; | 2469 | int i, j; |
2470 | int pmkid_len; | ||
2470 | 2471 | ||
2471 | WL_CONN("No of elements %d\n", pmk_list->pmkids.npmkid); | 2472 | pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid); |
2472 | for (i = 0; i < pmk_list->pmkids.npmkid; i++) { | 2473 | |
2474 | WL_CONN("No of elements %d\n", pmkid_len); | ||
2475 | for (i = 0; i < pmkid_len; i++) { | ||
2473 | WL_CONN("PMKID[%d]: %pM =\n", i, | 2476 | WL_CONN("PMKID[%d]: %pM =\n", i, |
2474 | &pmk_list->pmkids.pmkid[i].BSSID); | 2477 | &pmk_list->pmkids.pmkid[i].BSSID); |
2475 | for (j = 0; j < WLAN_PMKID_LEN; j++) | 2478 | for (j = 0; j < WLAN_PMKID_LEN; j++) |
@@ -2491,26 +2494,30 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, | |||
2491 | struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids; | 2494 | struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids; |
2492 | s32 err = 0; | 2495 | s32 err = 0; |
2493 | int i; | 2496 | int i; |
2497 | int pmkid_len; | ||
2494 | 2498 | ||
2495 | WL_TRACE("Enter\n"); | 2499 | WL_TRACE("Enter\n"); |
2496 | if (!check_sys_up(wiphy)) | 2500 | if (!check_sys_up(wiphy)) |
2497 | return -EIO; | 2501 | return -EIO; |
2498 | 2502 | ||
2499 | for (i = 0; i < pmkids->npmkid; i++) | 2503 | pmkid_len = le32_to_cpu(pmkids->npmkid); |
2504 | for (i = 0; i < pmkid_len; i++) | ||
2500 | if (!memcmp(pmksa->bssid, pmkids->pmkid[i].BSSID, ETH_ALEN)) | 2505 | if (!memcmp(pmksa->bssid, pmkids->pmkid[i].BSSID, ETH_ALEN)) |
2501 | break; | 2506 | break; |
2502 | if (i < WL_NUM_PMKIDS_MAX) { | 2507 | if (i < WL_NUM_PMKIDS_MAX) { |
2503 | memcpy(pmkids->pmkid[i].BSSID, pmksa->bssid, ETH_ALEN); | 2508 | memcpy(pmkids->pmkid[i].BSSID, pmksa->bssid, ETH_ALEN); |
2504 | memcpy(pmkids->pmkid[i].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); | 2509 | memcpy(pmkids->pmkid[i].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); |
2505 | if (i == pmkids->npmkid) | 2510 | if (i == pmkid_len) { |
2506 | pmkids->npmkid++; | 2511 | pmkid_len++; |
2512 | pmkids->npmkid = cpu_to_le32(pmkid_len); | ||
2513 | } | ||
2507 | } else | 2514 | } else |
2508 | err = -EINVAL; | 2515 | err = -EINVAL; |
2509 | 2516 | ||
2510 | WL_CONN("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", | 2517 | WL_CONN("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", |
2511 | pmkids->pmkid[pmkids->npmkid].BSSID); | 2518 | pmkids->pmkid[pmkid_len].BSSID); |
2512 | for (i = 0; i < WLAN_PMKID_LEN; i++) | 2519 | for (i = 0; i < WLAN_PMKID_LEN; i++) |
2513 | WL_CONN("%02x\n", pmkids->pmkid[pmkids->npmkid].PMKID[i]); | 2520 | WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]); |
2514 | 2521 | ||
2515 | err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); | 2522 | err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); |
2516 | 2523 | ||
@@ -2525,7 +2532,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, | |||
2525 | struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | 2532 | struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); |
2526 | struct pmkid_list pmkid; | 2533 | struct pmkid_list pmkid; |
2527 | s32 err = 0; | 2534 | s32 err = 0; |
2528 | int i; | 2535 | int i, pmkid_len; |
2529 | 2536 | ||
2530 | WL_TRACE("Enter\n"); | 2537 | WL_TRACE("Enter\n"); |
2531 | if (!check_sys_up(wiphy)) | 2538 | if (!check_sys_up(wiphy)) |
@@ -2539,17 +2546,18 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, | |||
2539 | for (i = 0; i < WLAN_PMKID_LEN; i++) | 2546 | for (i = 0; i < WLAN_PMKID_LEN; i++) |
2540 | WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]); | 2547 | WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]); |
2541 | 2548 | ||
2542 | for (i = 0; i < cfg_priv->pmk_list->pmkids.npmkid; i++) | 2549 | pmkid_len = le32_to_cpu(cfg_priv->pmk_list->pmkids.npmkid); |
2550 | for (i = 0; i < pmkid_len; i++) | ||
2543 | if (!memcmp | 2551 | if (!memcmp |
2544 | (pmksa->bssid, &cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, | 2552 | (pmksa->bssid, &cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, |
2545 | ETH_ALEN)) | 2553 | ETH_ALEN)) |
2546 | break; | 2554 | break; |
2547 | 2555 | ||
2548 | if ((cfg_priv->pmk_list->pmkids.npmkid > 0) | 2556 | if ((pmkid_len > 0) |
2549 | && (i < cfg_priv->pmk_list->pmkids.npmkid)) { | 2557 | && (i < pmkid_len)) { |
2550 | memset(&cfg_priv->pmk_list->pmkids.pmkid[i], 0, | 2558 | memset(&cfg_priv->pmk_list->pmkids.pmkid[i], 0, |
2551 | sizeof(struct pmkid)); | 2559 | sizeof(struct pmkid)); |
2552 | for (; i < (cfg_priv->pmk_list->pmkids.npmkid - 1); i++) { | 2560 | for (; i < (pmkid_len - 1); i++) { |
2553 | memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, | 2561 | memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, |
2554 | &cfg_priv->pmk_list->pmkids.pmkid[i + 1].BSSID, | 2562 | &cfg_priv->pmk_list->pmkids.pmkid[i + 1].BSSID, |
2555 | ETH_ALEN); | 2563 | ETH_ALEN); |
@@ -2557,7 +2565,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, | |||
2557 | &cfg_priv->pmk_list->pmkids.pmkid[i + 1].PMKID, | 2565 | &cfg_priv->pmk_list->pmkids.pmkid[i + 1].PMKID, |
2558 | WLAN_PMKID_LEN); | 2566 | WLAN_PMKID_LEN); |
2559 | } | 2567 | } |
2560 | cfg_priv->pmk_list->pmkids.npmkid--; | 2568 | cfg_priv->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1); |
2561 | } else | 2569 | } else |
2562 | err = -EINVAL; | 2570 | err = -EINVAL; |
2563 | 2571 | ||
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h index e98ed50c67c7..452bd420df76 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h | |||
@@ -258,7 +258,7 @@ struct pmkid { | |||
258 | }; | 258 | }; |
259 | 259 | ||
260 | struct pmkid_list { | 260 | struct pmkid_list { |
261 | u32 npmkid; | 261 | __le32 npmkid; |
262 | struct pmkid pmkid[1]; | 262 | struct pmkid pmkid[1]; |
263 | }; | 263 | }; |
264 | 264 | ||