]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mac80211: fix two issues in debugfs
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 10 Oct 2008 15:52:49 +0000 (17:52 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 18 Oct 2008 17:49:11 +0000 (10:49 -0700)
Not in trees above 2.6.27 as it is fixed differently in .28.

This fixes RHBZ 466264, whenever the master interface is
renamed this code would BUG_ON. Also fixes a separately
reported bug with the debugfs dir being NULL.

This patch is not applicable to the next kernel version
because both these issues have been fixed, the first one
by not having the master interface have a ieee80211_ptr
at all, and the second one by also leaving the function
early.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: John Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/mac80211/debugfs_netdev.c

index 8165df578c92ecf5b29f84b315f0583809ac9840..5c7bbe07b79c5f617091ac4d3e44c6ad0e063324 100644 (file)
@@ -537,6 +537,7 @@ static int netdev_notify(struct notifier_block *nb,
 {
        struct net_device *dev = ndev;
        struct dentry *dir;
+       struct ieee80211_local *local;
        struct ieee80211_sub_if_data *sdata;
        char buf[10+IFNAMSIZ];
 
@@ -549,10 +550,19 @@ static int netdev_notify(struct notifier_block *nb,
        if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
                return 0;
 
-       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       /*
+        * Do not use IEEE80211_DEV_TO_SUB_IF because that
+        * BUG_ONs for the master netdev which we need to
+        * handle here.
+        */
+       sdata = netdev_priv(dev);
 
-       sprintf(buf, "netdev:%s", dev->name);
        dir = sdata->debugfsdir;
+
+       if (!dir)
+               return 0;
+
+       sprintf(buf, "netdev:%s", dev->name);
        if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
                printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs "
                       "dir to %s\n", buf);