diff options
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/debugfs.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index 1d68b6e63b96..b4ffba7dd583 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/stddef.h> | 31 | #include <linux/stddef.h> |
32 | #include <linux/stringify.h> | 32 | #include <linux/stringify.h> |
33 | #include <linux/sysfs.h> | 33 | #include <linux/sysfs.h> |
34 | #include <net/net_namespace.h> | ||
34 | 35 | ||
35 | #include "bat_algo.h" | 36 | #include "bat_algo.h" |
36 | #include "bridge_loop_avoidance.h" | 37 | #include "bridge_loop_avoidance.h" |
@@ -305,12 +306,16 @@ void batadv_debugfs_destroy(void) | |||
305 | */ | 306 | */ |
306 | int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface) | 307 | int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface) |
307 | { | 308 | { |
309 | struct net *net = dev_net(hard_iface->net_dev); | ||
308 | struct batadv_debuginfo **bat_debug; | 310 | struct batadv_debuginfo **bat_debug; |
309 | struct dentry *file; | 311 | struct dentry *file; |
310 | 312 | ||
311 | if (!batadv_debugfs) | 313 | if (!batadv_debugfs) |
312 | goto out; | 314 | goto out; |
313 | 315 | ||
316 | if (net != &init_net) | ||
317 | return 0; | ||
318 | |||
314 | hard_iface->debug_dir = debugfs_create_dir(hard_iface->net_dev->name, | 319 | hard_iface->debug_dir = debugfs_create_dir(hard_iface->net_dev->name, |
315 | batadv_debugfs); | 320 | batadv_debugfs); |
316 | if (!hard_iface->debug_dir) | 321 | if (!hard_iface->debug_dir) |
@@ -341,6 +346,11 @@ out: | |||
341 | */ | 346 | */ |
342 | void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface) | 347 | void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface) |
343 | { | 348 | { |
349 | struct net *net = dev_net(hard_iface->net_dev); | ||
350 | |||
351 | if (net != &init_net) | ||
352 | return; | ||
353 | |||
344 | if (batadv_debugfs) { | 354 | if (batadv_debugfs) { |
345 | debugfs_remove_recursive(hard_iface->debug_dir); | 355 | debugfs_remove_recursive(hard_iface->debug_dir); |
346 | hard_iface->debug_dir = NULL; | 356 | hard_iface->debug_dir = NULL; |
@@ -351,11 +361,15 @@ int batadv_debugfs_add_meshif(struct net_device *dev) | |||
351 | { | 361 | { |
352 | struct batadv_priv *bat_priv = netdev_priv(dev); | 362 | struct batadv_priv *bat_priv = netdev_priv(dev); |
353 | struct batadv_debuginfo **bat_debug; | 363 | struct batadv_debuginfo **bat_debug; |
364 | struct net *net = dev_net(dev); | ||
354 | struct dentry *file; | 365 | struct dentry *file; |
355 | 366 | ||
356 | if (!batadv_debugfs) | 367 | if (!batadv_debugfs) |
357 | goto out; | 368 | goto out; |
358 | 369 | ||
370 | if (net != &init_net) | ||
371 | return 0; | ||
372 | |||
359 | bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs); | 373 | bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs); |
360 | if (!bat_priv->debug_dir) | 374 | if (!bat_priv->debug_dir) |
361 | goto out; | 375 | goto out; |
@@ -392,6 +406,10 @@ out: | |||
392 | void batadv_debugfs_del_meshif(struct net_device *dev) | 406 | void batadv_debugfs_del_meshif(struct net_device *dev) |
393 | { | 407 | { |
394 | struct batadv_priv *bat_priv = netdev_priv(dev); | 408 | struct batadv_priv *bat_priv = netdev_priv(dev); |
409 | struct net *net = dev_net(dev); | ||
410 | |||
411 | if (net != &init_net) | ||
412 | return; | ||
395 | 413 | ||
396 | batadv_debug_log_cleanup(bat_priv); | 414 | batadv_debug_log_cleanup(bat_priv); |
397 | 415 | ||