Search Linux Wireless

[PATCH] mac80211: refuse invalid interface configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Refuse setting mesh_id on non-mesh or monitor flags on non-monitor
interfaces.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
---
 net/mac80211/cfg.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

--- everything.orig/net/mac80211/cfg.c	2008-09-16 20:24:53.000000000 +0200
+++ everything/net/mac80211/cfg.c	2008-09-16 20:28:14.000000000 +0200
@@ -105,14 +105,21 @@ static int ieee80211_change_iface(struct
 	if (netif_running(sdata->dev))
 		return -EBUSY;
 
-	if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
-		ieee80211_sdata_set_mesh_id(sdata,
-					    params->mesh_id_len,
-					    params->mesh_id);
+	if (params->mesh_id_len) {
+		if (ieee80211_vif_is_mesh(&sdata->vif))
+			ieee80211_sdata_set_mesh_id(sdata,
+						    params->mesh_id_len,
+						    params->mesh_id);
+		else
+			return -EINVAL;
+	}
 
-	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
+	if (!flags)
 		return 0;
 
+	if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
+		return -EINVAL;
+
 	sdata->u.mntr_flags = *flags;
 	return 0;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux