diff mbox

Remove batgat proc entries correctly

Message ID 20080911135327.GA21671@sven-desktop.lazhur.ath.cx
State Accepted, archived
Headers show

Commit Message

Sven Eckelmann Sept. 11, 2008, 1:53 p.m. UTC
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(-)

Comments

Marek Lindner Sept. 12, 2008, 2:33 a.m. UTC | #1
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
diff mbox

Patch

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)