Skip to contentSkip to conversation

cfg80211: Skip key deletion for open associations

PATCH In review [email protected] 2 participants 3 messages Jan 25, 2021 – Jan 26, 2021 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cfg80211: Skip key deletion for open associations

From: Chaitanya Tata <[email protected]>

From: Chaitanya Tata <[email protected]>

If the association is open (no authentication and encryption) no need to delete the keys, though this is handled by all drivers, this is unnecessary.

---
v2: Move kfree after check.

---
 net/wireless/sme.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
net/wireless/sme.c +4 -3
index 38df713f2e2e..016655595b48 100644
@@ -1098,8 +1098,6 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
 	wdev->current_bss = NULL;
 	wdev->ssid_len = 0;
 	wdev->conn_owner_nlportid = 0;
-	kfree_sensitive(wdev->connect_keys);
-	wdev->connect_keys = NULL;
 
 	nl80211_send_disconnected(rdev, dev, reason, ie, ie_len, from_ap);
 
@@ -1113,7 +1111,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
 	 * Delete all the keys ... pairwise keys can't really
 	 * exist any more anyway, but default keys might.
 	 */
-	if (rdev->ops->del_key) {
+	if (wdev->connect_keys && rdev->ops->del_key) {
 		int max_key_idx = 5;
 
 		if (wiphy_ext_feature_isset(
@@ -1127,6 +1125,9 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
 			rdev_del_key(rdev, dev, i, false, NULL);
 	}
 
+	kfree_sensitive(wdev->connect_keys);
+	wdev->connect_keys = NULL;
+
 	rdev_set_qos_map(rdev, dev, NULL);
 
 #ifdef CONFIG_CFG80211_WEXT
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 3 lines · On Tue, 2021-01-26 at 00:50 +0530, [email protected] wrote:

From: Chaitanya Tata <[email protected]>

From: Chaitanya Tata <[email protected]>

That's broken, please check your git mail setup.

net/wireless/sme.c void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, · line 1114

Quoted 6 lines
net/wireless/sme.c +1 -1
 	 * Delete all the keys ... pairwise keys can't really
 	 * exist any more anyway, but default keys might.
 	 */
-	if (rdev->ops->del_key) {
+	if (wdev->connect_keys && rdev->ops->del_key) {

This is wrong, wdev->connect_keys is not needed to make a secure connection.

johannes

#2 lore raw
Quoted 7 lines · Johannes Berg
Quoted 3 lines · On Tue, 2021-01-26 at 00:50 +0530, [email protected] wrote:

From: Chaitanya Tata <[email protected]>

From: Chaitanya Tata <[email protected]>

That's broken, please check your git mail setup.

Fixed.

Quoted 11 lines

net/wireless/sme.c void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, · line 1114

Quoted 8 lines

* Delete all the keys ... pairwise keys can't really
* exist any more anyway, but default keys might. */

net/wireless/sme.c +1 -1
-     if (rdev->ops->del_key) {
+     if (wdev->connect_keys && rdev->ops->del_key) {

This is wrong, wdev->connect_keys is not needed to make a secure connection.

Ah, I guess it's only for the WEP, right? From a quick look, we are not saving connect params (connect.crypto), will take a deeper look, thanks.