Commit 40c8e95a authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

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: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 66831075
...@@ -2467,9 +2467,12 @@ brcmf_update_pmklist(struct net_device *ndev, ...@@ -2467,9 +2467,12 @@ brcmf_update_pmklist(struct net_device *ndev,
struct brcmf_cfg80211_pmk_list *pmk_list, s32 err) struct brcmf_cfg80211_pmk_list *pmk_list, s32 err)
{ {
int i, j; int i, j;
int pmkid_len;
WL_CONN("No of elements %d\n", pmk_list->pmkids.npmkid); pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid);
for (i = 0; i < pmk_list->pmkids.npmkid; i++) {
WL_CONN("No of elements %d\n", pmkid_len);
for (i = 0; i < pmkid_len; i++) {
WL_CONN("PMKID[%d]: %pM =\n", i, WL_CONN("PMKID[%d]: %pM =\n", i,
&pmk_list->pmkids.pmkid[i].BSSID); &pmk_list->pmkids.pmkid[i].BSSID);
for (j = 0; j < WLAN_PMKID_LEN; j++) for (j = 0; j < WLAN_PMKID_LEN; j++)
...@@ -2491,26 +2494,30 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2491,26 +2494,30 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids; struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids;
s32 err = 0; s32 err = 0;
int i; int i;
int pmkid_len;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
return -EIO; return -EIO;
for (i = 0; i < pmkids->npmkid; i++) pmkid_len = le32_to_cpu(pmkids->npmkid);
for (i = 0; i < pmkid_len; i++)
if (!memcmp(pmksa->bssid, pmkids->pmkid[i].BSSID, ETH_ALEN)) if (!memcmp(pmksa->bssid, pmkids->pmkid[i].BSSID, ETH_ALEN))
break; break;
if (i < WL_NUM_PMKIDS_MAX) { if (i < WL_NUM_PMKIDS_MAX) {
memcpy(pmkids->pmkid[i].BSSID, pmksa->bssid, ETH_ALEN); memcpy(pmkids->pmkid[i].BSSID, pmksa->bssid, ETH_ALEN);
memcpy(pmkids->pmkid[i].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); memcpy(pmkids->pmkid[i].PMKID, pmksa->pmkid, WLAN_PMKID_LEN);
if (i == pmkids->npmkid) if (i == pmkid_len) {
pmkids->npmkid++; pmkid_len++;
pmkids->npmkid = cpu_to_le32(pmkid_len);
}
} else } else
err = -EINVAL; err = -EINVAL;
WL_CONN("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", WL_CONN("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n",
pmkids->pmkid[pmkids->npmkid].BSSID); pmkids->pmkid[pmkid_len].BSSID);
for (i = 0; i < WLAN_PMKID_LEN; i++) for (i = 0; i < WLAN_PMKID_LEN; i++)
WL_CONN("%02x\n", pmkids->pmkid[pmkids->npmkid].PMKID[i]); WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]);
err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err);
...@@ -2525,7 +2532,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2525,7 +2532,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
struct pmkid_list pmkid; struct pmkid_list pmkid;
s32 err = 0; s32 err = 0;
int i; int i, pmkid_len;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
...@@ -2539,17 +2546,18 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2539,17 +2546,18 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
for (i = 0; i < WLAN_PMKID_LEN; i++) for (i = 0; i < WLAN_PMKID_LEN; i++)
WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]); WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]);
for (i = 0; i < cfg_priv->pmk_list->pmkids.npmkid; i++) pmkid_len = le32_to_cpu(cfg_priv->pmk_list->pmkids.npmkid);
for (i = 0; i < pmkid_len; i++)
if (!memcmp if (!memcmp
(pmksa->bssid, &cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, (pmksa->bssid, &cfg_priv->pmk_list->pmkids.pmkid[i].BSSID,
ETH_ALEN)) ETH_ALEN))
break; break;
if ((cfg_priv->pmk_list->pmkids.npmkid > 0) if ((pmkid_len > 0)
&& (i < cfg_priv->pmk_list->pmkids.npmkid)) { && (i < pmkid_len)) {
memset(&cfg_priv->pmk_list->pmkids.pmkid[i], 0, memset(&cfg_priv->pmk_list->pmkids.pmkid[i], 0,
sizeof(struct pmkid)); sizeof(struct pmkid));
for (; i < (cfg_priv->pmk_list->pmkids.npmkid - 1); i++) { for (; i < (pmkid_len - 1); i++) {
memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].BSSID,
&cfg_priv->pmk_list->pmkids.pmkid[i + 1].BSSID, &cfg_priv->pmk_list->pmkids.pmkid[i + 1].BSSID,
ETH_ALEN); ETH_ALEN);
...@@ -2557,7 +2565,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2557,7 +2565,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
&cfg_priv->pmk_list->pmkids.pmkid[i + 1].PMKID, &cfg_priv->pmk_list->pmkids.pmkid[i + 1].PMKID,
WLAN_PMKID_LEN); WLAN_PMKID_LEN);
} }
cfg_priv->pmk_list->pmkids.npmkid--; cfg_priv->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1);
} else } else
err = -EINVAL; err = -EINVAL;
......
...@@ -258,7 +258,7 @@ struct pmkid { ...@@ -258,7 +258,7 @@ struct pmkid {
}; };
struct pmkid_list { struct pmkid_list {
u32 npmkid; __le32 npmkid;
struct pmkid pmkid[1]; struct pmkid pmkid[1];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment