From patchwork Thu Sep 11 13:53:27 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 5335 Received: from lana.hrz.tu-chemnitz.de (lana.hrz.tu-chemnitz.de [134.109.132.3]) by open-mesh.net (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id m8BDvk5N032476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 11 Sep 2008 15:57:47 +0200 Received: from galba.hrz.tu-chemnitz.de ([134.109.133.156] helo=mailbox.hrz.tu-chemnitz.de) by lana.hrz.tu-chemnitz.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Kdmbs-00027t-Lm for b.a.t.m.a.n@open-mesh.net; Thu, 11 Sep 2008 15:53:24 +0200 Received: from vpnclient-076.hrz.tu-chemnitz.de ([134.109.232.76] helo=sven-desktop) by mailbox.hrz.tu-chemnitz.de with smtp (Exim 4.69) (envelope-from ) id 1Kdmbs-0000A5-Cx for b.a.t.m.a.n@open-mesh.net; Thu, 11 Sep 2008 15:53:24 +0200 Received: by sven-desktop (nbSMTP-1.00) for uid 1000 sven.eckelmann@gmx.de; Thu, 11 Sep 2008 15:53:27 +0200 (CEST) Date: Thu, 11 Sep 2008 15:53:27 +0200 From: Sven Eckelmann To: b.a.t.m.a.n@open-mesh.net Message-ID: <20080911135327.GA21671@sven-desktop.lazhur.ath.cx> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Scan-Signature: cb5add96829c288e5da73fa3a8e2275c Subject: [B.A.T.M.A.N.] [PATCH] Remove batgat proc entries correctly X-BeenThere: b.a.t.m.a.n@open-mesh.net X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Sep 2008 13:57:48 -0000 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 --- 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)