Module: xenomai-3
Branch: stable-3.0.x
Commit: de66d324a93d8f56a0a44107eb69b7b36dd2c375
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=de66d324a93d8f56a0a44107eb69b7b36dd2c375

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Jul  4 15:50:12 2017 +0200

cobalt/procfs: fix conditional in cleanup_tree

Due to a build mismatch between the init and cleanup code regarding
/proc/xenomai/debug, we may end up with the latter directory leaking
upon error during the early init phase, leading to:

0.106758] WARNING: CPU: 1 PID: 1 at fs/proc/generic.c:579 
remove_proc_entry+0x160/0x188
[    0.106769] remove_proc_entry: removing non-empty directory '/proc/xenomai', 
leaking at least 'debug'
[    0.106778] Modules linked in:
[    0.106799] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.11.0-ipipe #1
[    0.106808] Hardware name: Altera SOCFPGA
[    0.106816] I-pipe domain: Linux
[    0.106845] [<c0112268>] (unwind_backtrace) from [<c010d018>] 
(show_stack+0x20/0x24)
[    0.106865] [<c010d018>] (show_stack) from [<c04692a8>] 
(dump_stack+0xa4/0xc0)
[    0.106886] [<c04692a8>] (dump_stack) from [<c0122644>] (__warn+0xf8/0x110)
[    0.106904] [<c0122644>] (__warn) from [<c01226a4>] 
(warn_slowpath_fmt+0x48/0x50)
[    0.106923] [<c01226a4>] (warn_slowpath_fmt) from [<c02e809c>] 
(remove_proc_entry+0x160/0x188)
[    0.106947] [<c02e809c>] (remove_proc_entry) from [<c020bfbc>] 
(xnvfile_destroy_root+0x34/0x38)
[    0.106967] [<c020bfbc>] (xnvfile_destroy_root) from [<c020c460>] 
(xnprocfs_cleanup_tree+0x50/0x54)
[    0.106989] [<c020c460>] (xnprocfs_cleanup_tree) from [<c0a16d34>] 
(xenomai_init+0x438/0x4ec)
[    0.107008] [<c0a16d34>] (xenomai_init) from [<c0101e10>] 
(do_one_initcall+0x50/0x17c)

---

 kernel/cobalt/procfs.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/procfs.c b/kernel/cobalt/procfs.c
index f338aa7..9d193af 100644
--- a/kernel/cobalt/procfs.c
+++ b/kernel/cobalt/procfs.c
@@ -215,8 +215,8 @@ static struct xnvfile_regular apc_vfile = {
 
 void xnprocfs_cleanup_tree(void)
 {
-#if XENO_DEBUG(COBALT)
-#if XENO_DEBUG(LOCKING)
+#ifdef CONFIG_XENO_OPT_DEBUG
+#ifdef CONFIG_XENO_DEBUG_LOCKING
        xnvfile_destroy_regular(&lock_vfile);
 #endif
        xnvfile_destroy_dir(&cobalt_debug_vfroot);
@@ -253,10 +253,10 @@ int __init xnprocfs_init_tree(void)
        xnvfile_init_regular("apc", &apc_vfile, &cobalt_vfroot);
 #ifdef CONFIG_XENO_OPT_DEBUG
        xnvfile_init_dir("debug", &cobalt_debug_vfroot, &cobalt_vfroot);
-#if XENO_DEBUG(LOCKING)
+#ifdef CONFIG_XENO_DEBUG_LOCKING
        xnvfile_init_regular("lock", &lock_vfile, &cobalt_debug_vfroot);
 #endif
-#endif /* XENO_DEBUG(COBALT) */
+#endif
 
        return 0;
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to