The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()
@ 2024-05-28 20:30 Alexander Mikhalitsyn
  2024-05-29  7:49 ` Christian Brauner
  2024-05-30  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Mikhalitsyn @ 2024-05-28 20:30 UTC (permalink / raw)
  To: edumazet
  Cc: kuba, dsahern, pabeni, stgraber, brauner, davem, netdev,
	linux-kernel, Alexander Mikhalitsyn

A recent change to inet_dump_ifaddr had the function incorrectly iterate
over net rather than tgt_net, resulting in the data coming for the
incorrect network namespace.

Fixes: cdb2f80f1c10 ("inet: use xa_array iterator to implement inet_dump_ifaddr()")
Reported-by: Stéphane Graber <stgraber@stgraber.org>
Closes: https://github.com/lxc/incus/issues/892
Bisected-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Tested-by: Stéphane Graber <stgraber@stgraber.org>
---
 net/ipv4/devinet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e827da128c5f..f3892ee9dfb3 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1903,7 +1903,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
 
 	cb->seq = inet_base_seq(tgt_net);
 
-	for_each_netdev_dump(net, dev, ctx->ifindex) {
+	for_each_netdev_dump(tgt_net, dev, ctx->ifindex) {
 		in_dev = __in_dev_get_rcu(dev);
 		if (!in_dev)
 			continue;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-30  2:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-28 20:30 [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr() Alexander Mikhalitsyn
2024-05-29  7:49 ` Christian Brauner
2024-05-29  8:29   ` Eric Dumazet
2024-05-29  8:52     ` Aleksandr Mikhalitsyn
2024-05-30  2:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox