Skip to contentSkip to conversation

nl80211: Fix unfiltered GET_INTERFACE dumps

PATCH In review Denis Kenzior 3 participants 5 messages Aug 25, 2016 – Aug 26, 2016 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nl80211: Fix unfiltered GET_INTERFACE dumps

dump_wiphy_parse only assigns filter_wiphy if one of the supported NL80211 attributes is present. So for unfiltered dumps, filter_wiphy was always initialized to 0, and only interface 0 was dumped.

This was introduced in commit 2d75da13fbb957e955d212555b91101cef36f0ce.

---
 net/wireless/nl80211.c | 1 +
 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
index 95d55d2..ddc994a 100644
@@ -2534,6 +2534,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
 		struct nl80211_dump_wiphy_state state = {};
 		int ret;
 
+		state.filter_wiphy = -1;
 		ret = nl80211_dump_wiphy_parse(skb, cb, &state);
 		if (ret)
 			return ret;
Signature · 1 line
2.7.3
#2 lore raw
In reply to Arend van Spriel

Hi Arend,

Quoted 5 lines · Arend van Spriel
Quoted 4 lines · Denis Kenzior

dump_wiphy_parse only assigns filter_wiphy if one of the supported NL80211 attributes is present. So for unfiltered dumps, filter_wiphy was always initialized to 0, and only interface 0 was dumped.

Quoted 7 lines
Quoted 3 lines

This was introduced in commit 2d75da13fbb957e955d212555b91101cef36f0ce.

Actually sent a patch for this issue a little earlier. I should have Cc'ed you explicitly, I guess.

Whoops. I saw your regression report and didn't look to see if you fixed it :)

Looking at your patch, I'm worried that

- int filter_wiphy = -1;
+ int filter_wiphy;

might still break things, since Johannes used:

	if (!cb->args[2]) {
		...
        } else if (cb->args[2] > 0) {
                filter_wiphy = cb->args[2] - 1;
        }

So for unfiltered dumps, filter_wiphy would not be initialized properly for the second & onward call of nl80211_dump_interface. Right?

Regards,
-Denis

#3 lore raw
Quoted 10 lines · Denis Kenzior

Hi Arend,

Quoted 7 lines · Arend van Spriel
Quoted 6 lines · Denis Kenzior

dump_wiphy_parse only assigns filter_wiphy if one of the supported NL80211 attributes is present. So for unfiltered dumps, filter_wiphy was always initialized to 0, and only interface 0 was dumped.

This was introduced in commit 2d75da13fbb957e955d212555b91101cef36f0ce.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Actually sent a patch for this issue a little earlier. I should have Cc'ed you explicitly, I guess.

Whoops. I saw your regression report and didn't look to see if you fixed it :)

I wanted to avoid having to revert so I decided to take a closer look.

Quoted 9 lines

Looking at your patch, I'm worried that

(quoted diff) +1 -1
-    int filter_wiphy = -1;
+    int filter_wiphy;

might still break things, since Johannes used:

    if (!cb->args[2]) {
        ...

Maybe my look was not close enough. In this branch cb->args[2] is set to -1. So indeed that would make filter_wiphy uninitialized in subsequent call(s). Thanks for catching that.

Regards,
Arend

Quoted 9 lines
        } else if (cb->args[2] > 0) {
                filter_wiphy = cb->args[2] - 1;
        }

So for unfiltered dumps, filter_wiphy would not be initialized properly for the second & onward call of nl80211_dump_interface. Right?

Regards,
-Denis

#1 lore raw
In reply to Denis Kenzior
Quoted 7 lines · Denis Kenzior

dump_wiphy_parse only assigns filter_wiphy if one of the supported NL80211 attributes is present. So for unfiltered dumps, filter_wiphy was always initialized to 0, and only interface 0 was dumped.

This was introduced in commit 2d75da13fbb957e955d212555b91101cef36f0ce.

Actually sent a patch for this issue a little earlier. I should have Cc'ed you explicitly, I guess.

Regards,
Arend

Quoted 18 lines
---
 net/wireless/nl80211.c | 1 +
 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
index 95d55d2..ddc994a 100644
@@ -2534,6 +2534,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
 		struct nl80211_dump_wiphy_state state = {};
 		int ret;
 
+		state.filter_wiphy = -1;
 		ret = nl80211_dump_wiphy_parse(skb, cb, &state);
 		if (ret)
 			return ret;
maintainer
#4 lore raw
In reply to Denis Kenzior
Quoted 10 lines · Denis Kenzior

dump_wiphy_parse only assigns filter_wiphy if one of the supported NL80211 attributes is present.  So for unfiltered dumps, filter_wiphy was always initialized to 0, and only interface 0 was dumped.

This was introduced in commit
2d75da13fbb957e955d212555b91101cef36f0ce.

Thanks guys, I've squashed this (and moved it into the initializer we already had.)

johannes