[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.14 / 0098-proc-ns-use-d_set_d_op-API-to-set-dentry-ops-in-proc.patch
1 From 0b21a3eba2629ca8e573e5b0cd7d1627d17c7cf6 Mon Sep 17 00:00:00 2001
2 From: Pravin B Shelar <pshelar@nicira.com>
3 Date: Fri, 23 Mar 2012 15:02:55 -0700
4 Subject: [PATCH 098/147] proc-ns: use d_set_d_op() API to set dentry ops in
5 proc_ns_instantiate().
7 commit 1b26c9b334044cff6d1d2698f2be41bc7d9a0864 upstream.
9 The namespace cleanup path leaks a dentry which holds a reference count
10 on a network namespace. Keeping that network namespace from being freed
11 when the last user goes away. Leaving things like vlan devices in the
12 leaked network namespace.
14 If you use ip netns add for much real work this problem becomes apparent
15 pretty quickly. It light testing the problem hides because frequently
16 you simply don't notice the leak.
18 Use d_set_d_op() so that DCACHE_OP_* flags are set correctly.
20 This issue exists back to 3.0.
22 Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
23 Reported-by: Justin Pettit <jpettit@nicira.com>
24 Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
25 Signed-off-by: Jesse Gross <jesse@nicira.com>
26 Cc: David Miller <davem@davemloft.net>
27 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
28 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30 ---
31 fs/proc/namespaces.c | 2 +-
32 1 file changed, 1 insertion(+), 1 deletion(-)
34 diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
35 index be177f7..d6c078e 100644
36 --- a/fs/proc/namespaces.c
37 +++ b/fs/proc/namespaces.c
38 @@ -54,7 +54,7 @@ static struct dentry *proc_ns_instantiate(struct inode *dir,
39 ei->ns_ops = ns_ops;
40 ei->ns = ns;
42 - dentry->d_op = &pid_dentry_operations;
43 + d_set_d_op(dentry, &pid_dentry_operations);
44 d_add(dentry, inode);
45 /* Close the race of the process dying before we return the dentry */
46 if (pid_revalidate(dentry, NULL))
47 --
48 1.7.9.4