Skip to contentSkip to conversation

Update get_net_ns_by_pid

PATCH In review Eric W. Biederman 2 participants 2 messages Sep 28, 2007

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

PATCH 1/1 Update get_net_ns_by_pid

In the -mm tree the rules for access an nsproxy have changed, and in get_net_ns_by_pid we access the nsproxy, so update it to follow the new rules.

---

net/core/rtnetlink.c +4 -4
index 739fbad..1caba10 100644
@@ -746,10 +746,10 @@ static struct net *get_net_ns_by_pid(pid_t pid)
 	rcu_read_lock();
 	tsk = find_task_by_pid(pid);
 	if (tsk) {
-		task_lock(tsk);
-		if (tsk->nsproxy)
-			net = get_net(tsk->nsproxy->net_ns);
-		task_unlock(tsk);
+		struct nsproxy *nsproxy;
+		nsproxy = task_nsproxy(tsk);
+		if (nsproxy)
+			net = get_net(nsproxy->net_ns);
 	}
 	rcu_read_unlock();
 	return net;
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eric W. Biederman

In the -mm tree the rules for access an nsproxy have changed, and in get_net_ns_by_pid we access the nsproxy, so update it to follow the new rules.

Yup, looks right.

I assume Pavel's Acked-by would actually matter, but still

thanks,
-serge

Quoted 25 lines

---

net/core/rtnetlink.c +4 -4
index 739fbad..1caba10 100644
@@ -746,10 +746,10 @@ static struct net *get_net_ns_by_pid(pid_t pid)
 	rcu_read_lock();
 	tsk = find_task_by_pid(pid);
 	if (tsk) {
-		task_lock(tsk);
-		if (tsk->nsproxy)
-			net = get_net(tsk->nsproxy->net_ns);
-		task_unlock(tsk);
+		struct nsproxy *nsproxy;
+		nsproxy = task_nsproxy(tsk);
+		if (nsproxy)
+			net = get_net(nsproxy->net_ns);
 	}
 	rcu_read_unlock();
 	return net;

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers