Skip to contentSkip to conversation

netns: Fix get_net_ns_by_pid

PATCH Applied Eric W. Biederman 2 participants 2 messages Oct 26, 2007 – Oct 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netns: Fix get_net_ns_by_pid

The pid namespace patches changed the semantics of find_task_by_pid without breaking the compile resulting in get_net_ns_by_pid doing the wrong thing.

So switch to using the intended find_task_by_vpid.

Combined with Denis' earlier patch to make netlink traffic fully synchronous the inadvertent race I introduced with accessing current is actually removed.

---
 net/core/rtnetlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/core/rtnetlink.c +1 -1
index 4a2640d..e1ba26f 100644
@@ -742,7 +742,7 @@ static struct net *get_net_ns_by_pid(pid_t pid)
 	/* Lookup the network namespace */
 	net = ERR_PTR(-ESRCH);
 	rcu_read_lock();
-	tsk = find_task_by_pid(pid);
+	tsk = find_task_by_vpid(pid);
 	if (tsk) {
 		struct nsproxy *nsproxy;
 		nsproxy = task_nsproxy(tsk);
Signature · 1 line
1.5.3.rc6.17.g1911
maintainer Applied
#1 lore raw

From: [email protected] (Eric W. Biederman)
Date: Fri, 26 Oct 2007 17:29:41 -0600

Quoted 5 lines

The pid namespace patches changed the semantics of find_task_by_pid without breaking the compile resulting in get_net_ns_by_pid doing the wrong thing.

Quoted 7 lines

So switch to using the intended find_task_by_vpid.

Combined with Denis' earlier patch to make netlink traffic fully synchronous the inadvertent race I introduced with accessing current is actually removed.

Applied, thanks.