aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2011-08-11 04:46:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-11 14:23:06 -0400
commitf612cedfe152b536197c0120f2e7779bc90219d0 (patch)
treec1ad3b3a00a26eff4b78d81331c168faf901a4ba
parent040bdf713d2bec8235f1af705e2d13da5d9baec8 (diff)
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: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/cfg80211.h5
-rw-r--r--net/mac80211/sta_info.c1
-rw-r--r--net/wireless/nl80211.c1
3 files changed, 7 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 96876d366c6..ab124407592 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -563,6 +563,11 @@ struct station_info {
563 563
564 const u8 *assoc_req_ies; 564 const u8 *assoc_req_ies;
565 size_t assoc_req_ies_len; 565 size_t assoc_req_ies_len;
566
567 /*
568 * Note: Add a new enum station_info_flags value for each new field and
569 * use it to check which fields are initialized.
570 */
566}; 571};
567 572
568/** 573/**
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 3db78b696c5..5eaa1673a8f 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -330,6 +330,7 @@ static int sta_info_finish_insert(struct sta_info *sta, bool async)
330 ieee80211_sta_debugfs_add(sta); 330 ieee80211_sta_debugfs_add(sta);
331 rate_control_add_sta_debugfs(sta); 331 rate_control_add_sta_debugfs(sta);
332 332
333 memset(&sinfo, 0, sizeof(sinfo));
333 sinfo.filled = 0; 334 sinfo.filled = 0;
334 sinfo.generation = local->sta_generation; 335 sinfo.generation = local->sta_generation;
335 cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); 336 cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 253e56319d7..080fd470fde 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2267,6 +2267,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
2267 } 2267 }
2268 2268
2269 while (1) { 2269 while (1) {
2270 memset(&sinfo, 0, sizeof(sinfo));
2270 err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx, 2271 err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx,
2271 mac_addr, &sinfo); 2272 mac_addr, &sinfo);
2272 if (err == -ENOENT) 2273 if (err == -ENOENT)