mirror of
https://git.yoctoproject.org/meta-ti
synced 2026-07-17 06:48:07 +00:00
189ce92b4c
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
82 lines
2.6 KiB
Diff
82 lines
2.6 KiB
Diff
From 5b6e7b80e2a121632158da46a21f6be9d561ce8c Mon Sep 17 00:00:00 2001
|
|
From: Johannes Berg <johannes.berg@intel.com>
|
|
Date: Tue, 5 Jun 2012 12:16:50 +0200
|
|
Subject: [PATCH 32/67] cfg80211: fix interface combinations check
|
|
|
|
commit 463454b5dbd8dbab6e2fc6c557329e5b811b9c32 upstream.
|
|
|
|
If a given interface combination doesn't contain
|
|
a required interface type then we missed checking
|
|
that and erroneously allowed it even though iface
|
|
type wasn't there at all. Add a check that makes
|
|
sure that all interface types are accounted for.
|
|
|
|
Reported-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
|
|
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
|
Signed-off-by: John W. Linville <linville@tuxdriver.com>
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
---
|
|
net/wireless/util.c | 19 ++++++++++++++++++-
|
|
1 file changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/net/wireless/util.c b/net/wireless/util.c
|
|
index 8bf8902..d38815d 100644
|
|
--- a/net/wireless/util.c
|
|
+++ b/net/wireless/util.c
|
|
@@ -943,6 +943,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
|
|
enum nl80211_iftype iftype)
|
|
{
|
|
struct wireless_dev *wdev_iter;
|
|
+ u32 used_iftypes = BIT(iftype);
|
|
int num[NUM_NL80211_IFTYPES];
|
|
int total = 1;
|
|
int i, j;
|
|
@@ -976,12 +977,14 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
|
|
|
|
num[wdev_iter->iftype]++;
|
|
total++;
|
|
+ used_iftypes |= BIT(wdev_iter->iftype);
|
|
}
|
|
mutex_unlock(&rdev->devlist_mtx);
|
|
|
|
for (i = 0; i < rdev->wiphy.n_iface_combinations; i++) {
|
|
const struct ieee80211_iface_combination *c;
|
|
struct ieee80211_iface_limit *limits;
|
|
+ u32 all_iftypes = 0;
|
|
|
|
c = &rdev->wiphy.iface_combinations[i];
|
|
|
|
@@ -996,6 +999,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
|
|
if (rdev->wiphy.software_iftypes & BIT(iftype))
|
|
continue;
|
|
for (j = 0; j < c->n_limits; j++) {
|
|
+ all_iftypes |= limits[j].types;
|
|
if (!(limits[j].types & BIT(iftype)))
|
|
continue;
|
|
if (limits[j].max < num[iftype])
|
|
@@ -1003,7 +1007,20 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
|
|
limits[j].max -= num[iftype];
|
|
}
|
|
}
|
|
- /* yay, it fits */
|
|
+
|
|
+ /*
|
|
+ * Finally check that all iftypes that we're currently
|
|
+ * using are actually part of this combination. If they
|
|
+ * aren't then we can't use this combination and have
|
|
+ * to continue to the next.
|
|
+ */
|
|
+ if ((all_iftypes & used_iftypes) != used_iftypes)
|
|
+ goto cont;
|
|
+
|
|
+ /*
|
|
+ * This combination covered all interface types and
|
|
+ * supported the requested numbers, so we're good.
|
|
+ */
|
|
kfree(limits);
|
|
return 0;
|
|
cont:
|
|
--
|
|
1.7.9.5
|
|
|