Skip to contentSkip to conversation

cfg80211: fix regulatory NULL dereference

PATCH In review Johannes Berg 2 participants 3 messages Nov 21, 2011 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 cfg80211: fix regulatory NULL dereference

From: Johannes Berg <[email protected]>

By the time userspace returns with a response to the regulatory domain request, the wiphy causing the request might have gone away. If this is so, reject the update but mark the request as having been processed anyway.

Cc Luis R. Rodriguez <[email protected]>
---
 net/wireless/reg.c |    4 ++++
 1 file changed, 4 insertions(+)
net/wireless/reg.c +4 -0
@@ -2037,6 +2037,10 @@ static int __set_regdom(const struct iee
 	}
 
 	request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
+	if (!request_wiphy) {
+		reg_set_request_processed();
+		return -ENODEV;
+	}
 
 	if (!last_request->intersect) {
 		int r;
#2 lore raw
In reply to Johannes Berg
Quoted 17 lines · Johannes Berg

From: Johannes Berg <[email protected]>

By the time userspace returns with a response to the regulatory domain request, the wiphy causing the request might have gone away. If this is so, reject the update but mark the request as having been processed anyway.

Cc Luis R. Rodriguez <[email protected]>

---
 net/wireless/reg.c |    4 ++++

 1 file changed, 4 insertions(+)

net/wireless/reg.c        2011-11-21 10:41:57.000000000 +0100 static int __set_regdom(const struct iee · line 2046

Quoted 10 lines
net/wireless/reg.c        2011-11-21 10:41:57.000000000 +0100 renamed from net/wireless/reg.c        2011-11-10 09:27:32.000000000 +0100 +4 -0
@@ -2037,6 +2037,10 @@ static int __set_regdom(const struct iee
        }
 
        request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
+       if (!request_wiphy) {
+               reg_set_request_processed();
+               return -ENODEV;
+       }
 
        if (!last_request->intersect) {
                int r;

last_request is still populated with the driver request info though, so you'd have to reset_regdomains() too to clear last_request as if we're starting all over again. If you don't get to it, I'm working on two fixes that cover this.

Luis