netdev.vger.kernel.org archive mirror
 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

* Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()
  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-30  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Christian Brauner @ 2024-05-29  7:49 UTC (permalink / raw)
  To: Alexander Mikhalitsyn
  Cc: edumazet, kuba, dsahern, pabeni, stgraber, davem, netdev,
	linux-kernel

On Tue, May 28, 2024 at 10:30:30PM +0200, Alexander Mikhalitsyn wrote:
> 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>
> ---

Acked-by: Christian Brauner <brauner@kernel.org>

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

* Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()
  2024-05-29  7:49 ` Christian Brauner
@ 2024-05-29  8:29   ` Eric Dumazet
  2024-05-29  8:52     ` Aleksandr Mikhalitsyn
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2024-05-29  8:29 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Alexander Mikhalitsyn, kuba, dsahern, pabeni, stgraber, davem,
	netdev, linux-kernel

On Wed, May 29, 2024 at 9:49 AM Christian Brauner <brauner@kernel.org> wrote:
>
> On Tue, May 28, 2024 at 10:30:30PM +0200, Alexander Mikhalitsyn wrote:
> > 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>
> > ---
>
> Acked-by: Christian Brauner <brauner@kernel.org>

Thanks a lot for the bisection and the fix !

Reviewed-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()
  2024-05-29  8:29   ` Eric Dumazet
@ 2024-05-29  8:52     ` Aleksandr Mikhalitsyn
  0 siblings, 0 replies; 5+ messages in thread
From: Aleksandr Mikhalitsyn @ 2024-05-29  8:52 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Christian Brauner, kuba, dsahern, pabeni, stgraber, davem, netdev,
	linux-kernel

On Wed, May 29, 2024 at 10:29 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, May 29, 2024 at 9:49 AM Christian Brauner <brauner@kernel.org> wrote:
> >
> > On Tue, May 28, 2024 at 10:30:30PM +0200, Alexander Mikhalitsyn wrote:
> > > 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>
> > > ---
> >
> > Acked-by: Christian Brauner <brauner@kernel.org>
>
> Thanks a lot for the bisection and the fix !

Thanks, Eric!

>
> Reviewed-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()
  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-30  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-30  2:00 UTC (permalink / raw)
  To: Aleksandr Mikhalitsyn
  Cc: edumazet, kuba, dsahern, pabeni, stgraber, brauner, davem, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 28 May 2024 22:30:30 +0200 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()
    https://git.kernel.org/netdev/net/c/b8c8abefc07b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[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;
as well as URLs for NNTP newsgroup(s).