mac80211: fix debugfs netdev rename
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 8 Oct 2008 08:18:36 +0000 (10:18 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 15 Oct 2008 00:48:00 +0000 (20:48 -0400)
If, for some reason, a netdev has no debugfs dir, we shouldn't
try to rename that dir.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Robin Holt <holt@sgi.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/debugfs_netdev.c

index 2a451562377608788b5e7ece2beac917320dca43..2ad504fc3414e19eb1b43cef909af2a68214de4b 100644 (file)
@@ -545,8 +545,12 @@ static int netdev_notify(struct notifier_block *nb,
 
        sdata = IEEE80211_DEV_TO_SUB_IF(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);