aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-09-10 06:39:54 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-09-11 06:07:18 -0400
commitb47f610bd6e88f9d1032132d81b23c928a645e9d (patch)
treeb56c9e36f4748850cd1def47a92adbcda9d97c9f /net/wireless
parentb1e9be8775b85d761cdb91386200a04d741f6a0d (diff)
cfg80211: clear connect keys when freeing them
When freeing the connect keys, clear the memory to avoid having the key material stick around in memory "forever". Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/ibss.c4
-rw-r--r--net/wireless/nl80211.c8
-rw-r--r--net/wireless/sme.c6
-rw-r--r--net/wireless/util.c2
-rw-r--r--net/wireless/wext-sme.c2
5 files changed, 11 insertions, 11 deletions
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 8f345da3ea5f..e24fc585c883 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -115,7 +115,7 @@ static int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
115 } 115 }
116 116
117 if (WARN_ON(wdev->connect_keys)) 117 if (WARN_ON(wdev->connect_keys))
118 kfree(wdev->connect_keys); 118 kzfree(wdev->connect_keys);
119 wdev->connect_keys = connkeys; 119 wdev->connect_keys = connkeys;
120 120
121 wdev->ibss_fixed = params->channel_fixed; 121 wdev->ibss_fixed = params->channel_fixed;
@@ -161,7 +161,7 @@ static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext)
161 161
162 ASSERT_WDEV_LOCK(wdev); 162 ASSERT_WDEV_LOCK(wdev);
163 163
164 kfree(wdev->connect_keys); 164 kzfree(wdev->connect_keys);
165 wdev->connect_keys = NULL; 165 wdev->connect_keys = NULL;
166 166
167 rdev_set_qos_map(rdev, dev, NULL); 167 rdev_set_qos_map(rdev, dev, NULL);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cf178d2b621d..e388a9f28895 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6866,7 +6866,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
6866 6866
6867 err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys); 6867 err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys);
6868 if (err) 6868 if (err)
6869 kfree(connkeys); 6869 kzfree(connkeys);
6870 return err; 6870 return err;
6871} 6871}
6872 6872
@@ -7235,7 +7235,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
7235 7235
7236 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) { 7236 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) {
7237 if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) { 7237 if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) {
7238 kfree(connkeys); 7238 kzfree(connkeys);
7239 return -EINVAL; 7239 return -EINVAL;
7240 } 7240 }
7241 memcpy(&connect.ht_capa, 7241 memcpy(&connect.ht_capa,
@@ -7253,7 +7253,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
7253 7253
7254 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) { 7254 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) {
7255 if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) { 7255 if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) {
7256 kfree(connkeys); 7256 kzfree(connkeys);
7257 return -EINVAL; 7257 return -EINVAL;
7258 } 7258 }
7259 memcpy(&connect.vht_capa, 7259 memcpy(&connect.vht_capa,
@@ -7273,7 +7273,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
7273 err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL); 7273 err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL);
7274 wdev_unlock(dev->ieee80211_ptr); 7274 wdev_unlock(dev->ieee80211_ptr);
7275 if (err) 7275 if (err)
7276 kfree(connkeys); 7276 kzfree(connkeys);
7277 return err; 7277 return err;
7278} 7278}
7279 7279
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 8bbeeb302216..dc1668ff543b 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -641,7 +641,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
641 } 641 }
642 642
643 if (status != WLAN_STATUS_SUCCESS) { 643 if (status != WLAN_STATUS_SUCCESS) {
644 kfree(wdev->connect_keys); 644 kzfree(wdev->connect_keys);
645 wdev->connect_keys = NULL; 645 wdev->connect_keys = NULL;
646 wdev->ssid_len = 0; 646 wdev->ssid_len = 0;
647 if (bss) { 647 if (bss) {
@@ -918,7 +918,7 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
918 ASSERT_WDEV_LOCK(wdev); 918 ASSERT_WDEV_LOCK(wdev);
919 919
920 if (WARN_ON(wdev->connect_keys)) { 920 if (WARN_ON(wdev->connect_keys)) {
921 kfree(wdev->connect_keys); 921 kzfree(wdev->connect_keys);
922 wdev->connect_keys = NULL; 922 wdev->connect_keys = NULL;
923 } 923 }
924 924
@@ -978,7 +978,7 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
978 978
979 ASSERT_WDEV_LOCK(wdev); 979 ASSERT_WDEV_LOCK(wdev);
980 980
981 kfree(wdev->connect_keys); 981 kzfree(wdev->connect_keys);
982 wdev->connect_keys = NULL; 982 wdev->connect_keys = NULL;
983 983
984 if (wdev->conn) 984 if (wdev->conn)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index a8b2816ffcb9..5e233a577d0f 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -797,7 +797,7 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
797 netdev_err(dev, "failed to set mgtdef %d\n", i); 797 netdev_err(dev, "failed to set mgtdef %d\n", i);
798 } 798 }
799 799
800 kfree(wdev->connect_keys); 800 kzfree(wdev->connect_keys);
801 wdev->connect_keys = NULL; 801 wdev->connect_keys = NULL;
802} 802}
803 803
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index c7e5c8eb4f24..368611c05739 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -57,7 +57,7 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
57 err = cfg80211_connect(rdev, wdev->netdev, 57 err = cfg80211_connect(rdev, wdev->netdev,
58 &wdev->wext.connect, ck, prev_bssid); 58 &wdev->wext.connect, ck, prev_bssid);
59 if (err) 59 if (err)
60 kfree(ck); 60 kzfree(ck);
61 61
62 return err; 62 return err;
63} 63}