public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] Remove batgat proc entries correctly
@ 2008-09-11 13:53 Sven Eckelmann
  2008-09-12  2:33 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2008-09-11 13:53 UTC (permalink / raw)
  To: b.a.t.m.a.n

We must remove the /proc/net/batgat/clients file and /proc/net/batgat dir
correctly or otherwise we will get a oops when someone tries to access the
file. If we do not remove the directory it is possible that more then one batgat
entry appears inside of /proc/net/

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/linux/modules/gateway.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/batman/linux/modules/gateway.c b/batman/linux/modules/gateway.c
index e90be0b..d7af197 100644
--- a/batman/linux/modules/gateway.c
+++ b/batman/linux/modules/gateway.c
@@ -769,8 +769,16 @@ int choose_vip(void *data, int32_t size)
 
 static void cleanup_procfs(void)
 {
-	if(clients_file) remove_proc_entry("PROC_FILE_CLIENTS", proc_dir);
-	if(proc_dir) remove_proc_entry(PROC_ROOT_DIR, NULL);
+	if (clients_file)
+		remove_proc_entry(PROC_FILE_CLIENTS, proc_dir);
+
+#ifdef __NET_NET_NAMESPACE_H
+	if (proc_dir)
+		remove_proc_entry(PROC_ROOT_DIR, init_net.proc_net);
+#else
+	if (proc_dir)
+		remove_proc_entry(PROC_ROOT_DIR, proc_net);
+#endif
 }
 
 static int setup_procfs(void)
-- 
1.6.0.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] Remove batgat proc entries correctly
  2008-09-11 13:53 [B.A.T.M.A.N.] [PATCH] Remove batgat proc entries correctly Sven Eckelmann
@ 2008-09-12  2:33 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2008-09-12  2:33 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, 11. September 2008 21:53:27 Sven Eckelmann wrote:
> We must remove the /proc/net/batgat/clients file and /proc/net/batgat dir
> correctly or otherwise we will get a oops when someone tries to access the
> file. If we do not remove the directory it is possible that more then one
> batgat entry appears inside of /proc/net/

Your patches look very good. Nice catch !
Simon already applied them. 

Thanks,
Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-12  2:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-11 13:53 [B.A.T.M.A.N.] [PATCH] Remove batgat proc entries correctly Sven Eckelmann
2008-09-12  2:33 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox