Commit f612cedf authored by Jouni Malinen's avatar Jouni Malinen Committed by John W. Linville

nl80211/cfg80211: Make addition of new sinfo fields safer

Add a comment pointing out the use of enum station_info_flags for
all new struct station_info fields. In addition, memset the sinfo
buffer to zero before use on all paths in the current tree to avoid
leaving uninitialized pointers in the data.
Signed-off-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 040bdf71
...@@ -563,6 +563,11 @@ struct station_info { ...@@ -563,6 +563,11 @@ struct station_info {
const u8 *assoc_req_ies; const u8 *assoc_req_ies;
size_t assoc_req_ies_len; size_t assoc_req_ies_len;
/*
* Note: Add a new enum station_info_flags value for each new field and
* use it to check which fields are initialized.
*/
}; };
/** /**
......
...@@ -330,6 +330,7 @@ static int sta_info_finish_insert(struct sta_info *sta, bool async) ...@@ -330,6 +330,7 @@ static int sta_info_finish_insert(struct sta_info *sta, bool async)
ieee80211_sta_debugfs_add(sta); ieee80211_sta_debugfs_add(sta);
rate_control_add_sta_debugfs(sta); rate_control_add_sta_debugfs(sta);
memset(&sinfo, 0, sizeof(sinfo));
sinfo.filled = 0; sinfo.filled = 0;
sinfo.generation = local->sta_generation; sinfo.generation = local->sta_generation;
cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
......
...@@ -2267,6 +2267,7 @@ static int nl80211_dump_station(struct sk_buff *skb, ...@@ -2267,6 +2267,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
} }
while (1) { while (1) {
memset(&sinfo, 0, sizeof(sinfo));
err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx, err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx,
mac_addr, &sinfo); mac_addr, &sinfo);
if (err == -ENOENT) if (err == -ENOENT)
......
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