summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2011-08-11 11:46:22 +0300
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-02-03 05:54:57 -0800
commit433721b4cc57e3a6a34a9b013b1a4aac5a9e644f (patch)
tree5d6f57398ef8a1984e72d7ee8b10275fce9024ed
parentd09473cbe8bf2146ee99178050d9ba698131f80e (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. (cherry picked from commit 87159de9c30dab02b84cbaffa7498140d4ebc1a1 from android.googlesource.com/common.git) Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Change-Id: I24301d45108587e66c8421a7f2a94ea98300ebeb Reviewed-on: http://git-master/r/78887 Reviewed-by: Automatic_Commit_Validation_User
-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 fe7627847a72..ffa8aedd70f0 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -566,6 +566,11 @@ struct station_info {
const u8 *assoc_req_ies;
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.
+ */
};
/**
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 21070e9bc8d0..57cf52873841 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)
ieee80211_sta_debugfs_add(sta);
rate_control_add_sta_debugfs(sta);
+ memset(&sinfo, 0, sizeof(sinfo));
sinfo.filled = 0;
sinfo.generation = local->sta_generation;
cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index bbf42aa22031..fb18bb4dea7a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2267,6 +2267,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
}
while (1) {
+ memset(&sinfo, 0, sizeof(sinfo));
err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx,
mac_addr, &sinfo);
if (err == -ENOENT)