Remove batgat proc entries correctly
Commit Message
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
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
@@ -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)