Skip to contentSkip to conversation

d80211: don't symlink empty default keys

PATCH In review Jan Kiszka 2 participants 5 messages Jan 9, 2007 – Jan 10, 2007

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 d80211: don't symlink empty default keys

This gets rid of annoying

wlan0: cannot create symlink to default key

in my syslog with latest rt2x00. The patch takes care that in case of (key/old_key == NULL && set_tx_key) the existing default key symlink is removed correctly. Moreover, it tests for key!=NULL before trying to register a new default link.

---
 ieee80211/ieee80211_ioctl.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
ieee80211/ieee80211_ioctl.c +3 -3
Index: rt2x00/ieee80211/ieee80211_ioctl.c
===================================================================
@@ -629,7 +629,7 @@ static int ieee80211_set_encryption(stru
 		}
 		kfree(keyconf);
 
-		if (key && sdata->default_key == key) {
+		if (set_tx_key || (key && sdata->default_key == key)) {
 			ieee80211_key_sysfs_remove_default(sdata);
 			sdata->default_key = NULL;
 		}
@@ -673,7 +673,7 @@ static int ieee80211_set_encryption(stru
 			}
 		}
 
-		if (old_key && sdata->default_key == old_key) {
+		if (set_tx_key || (old_key && sdata->default_key == old_key)) {
 			ieee80211_key_sysfs_remove_default(sdata);
 			sdata->default_key = NULL;
 		}
@@ -700,7 +700,7 @@ static int ieee80211_set_encryption(stru
 
 	if (set_tx_key || (!sta && !sdata->default_key && key)) {
 		sdata->default_key = key;
-		if (ieee80211_key_sysfs_add_default(sdata))
+		if (key && ieee80211_key_sysfs_add_default(sdata))
 			printk(KERN_WARNING "%s: cannot create symlink to "
 			       "default key\n", dev->name);
 		if (local->ops->set_key_idx &&
author
#1 lore raw
Quoted 9 lines · Jan Kiszka

This gets rid of annoying

wlan0: cannot create symlink to default key

in my syslog with latest rt2x00. The patch takes care that in case of (key/old_key == NULL && set_tx_key) the existing default key symlink is removed correctly. Moreover, it tests for key!=NULL before trying to register a new default link.

Grr, just noticed that the subject was still only reflecting one part of the patch. Let's call it "fix default key symlink creation/cleanup".

Jan

#2 lore raw
In reply to Jan Kiszka
Quoted 20 lines · Jan Kiszka

This gets rid of annoying

wlan0: cannot create symlink to default key

in my syslog with latest rt2x00. The patch takes care that in case of (key/old_key == NULL && set_tx_key) the existing default key symlink is removed correctly. Moreover, it tests for key!=NULL before trying to register a new default link.

---
 ieee80211/ieee80211_ioctl.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: rt2x00/ieee80211/ieee80211_ioctl.c
===================================================================

ieee80211/ieee80211_ioctl.c static int ieee80211_set_encryption(stru · line 633

Quoted 6 lines
ieee80211/ieee80211_ioctl.c +1 -1
@@ -629,7 +629,7 @@ static int ieee80211_set_encryption(stru
 		}
 		kfree(keyconf);
 
-		if (key && sdata->default_key == key) {
+		if (set_tx_key || (key && sdata->default_key == key)) {
 			ieee80211_key_sysfs_remove_default(sdata);

This is not correct when set_tx_key is set and sdata->default_key is NULL.

Thanks,

Jiri

Signature · 2 lines
Jiri Benc
SUSE Labs
author
#3 lore raw
Quoted 24 lines · Jiri Benc
Quoted 23 lines · Jan Kiszka

This gets rid of annoying

wlan0: cannot create symlink to default key

in my syslog with latest rt2x00. The patch takes care that in case of (key/old_key == NULL && set_tx_key) the existing default key symlink is removed correctly. Moreover, it tests for key!=NULL before trying to register a new default link.

---
 ieee80211/ieee80211_ioctl.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: rt2x00/ieee80211/ieee80211_ioctl.c
===================================================================

ieee80211/ieee80211_ioctl.c +0 -0
@@ -629,7 +629,7 @@ static int ieee80211_set_encryption(stru
 		}
 		kfree(keyconf);
 
Quoted 6 lines

ieee80211/ieee80211_ioctl.c static int ieee80211_set_encryption(stru · line 633

Quoted 3 lines
ieee80211/ieee80211_ioctl.c +1 -1
-		if (key && sdata->default_key == key) {
+		if (set_tx_key || (key && sdata->default_key == key)) {
 			ieee80211_key_sysfs_remove_default(sdata);

This is not correct when set_tx_key is set and sdata->default_key is NULL.

Hmm, is this required? Will sysfs_remove_link panic on non-existent nodes? If yes or if it's considered better style, are you OK with catching NULL in ieee80211_key_sysfs_remove_default and refactoring the existing tests along this way?

Jan

#4 lore raw
Quoted 2 lines · Jan Kiszka

Hmm, is this required? Will sysfs_remove_link panic on non-existent nodes?

No, it won't.

Quoted 1 line

If yes or if it's considered better style,

I consider it a better style as it's more tolerant to possible changes in sysfs_remove_link.

Quoted 3 lines

are you OK with
catching NULL in ieee80211_key_sysfs_remove_default and refactoring the existing tests along this way?

Yes.

Thanks,

Jiri

Signature · 2 lines
Jiri Benc
SUSE Labs