2024-05-28 21:06:49

by Aleksandr Mikhalitsyn

[permalink] [raw]
Subject: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()

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 <[email protected]>
Closes: https://github.com/lxc/incus/issues/892
Bisected-by: Stéphane Graber <[email protected]>
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Tested-by: Stéphane Graber <[email protected]>
---
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



2024-05-29 07:58:54

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()

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 <[email protected]>
> Closes: https://github.com/lxc/incus/issues/892
> Bisected-by: Stéphane Graber <[email protected]>
> Signed-off-by: Alexander Mikhalitsyn <[email protected]>
> Tested-by: Stéphane Graber <[email protected]>
> ---

Acked-by: Christian Brauner <[email protected]>

2024-05-29 08:39:47

by Eric Dumazet

[permalink] [raw]
Subject: Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()

On Wed, May 29, 2024 at 9:49 AM Christian Brauner <[email protected]> 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 <[email protected]>
> > Closes: https://github.com/lxc/incus/issues/892
> > Bisected-by: Stéphane Graber <[email protected]>
> > Signed-off-by: Alexander Mikhalitsyn <[email protected]>
> > Tested-by: Stéphane Graber <[email protected]>
> > ---
>
> Acked-by: Christian Brauner <[email protected]>

Thanks a lot for the bisection and the fix !

Reviewed-by: Eric Dumazet <[email protected]>

2024-05-29 08:54:03

by Aleksandr Mikhalitsyn

[permalink] [raw]
Subject: Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()

On Wed, May 29, 2024 at 10:29 AM Eric Dumazet <[email protected]> wrote:
>
> On Wed, May 29, 2024 at 9:49 AM Christian Brauner <brauner@kernelorg> 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 <[email protected]>
> > > Closes: https://github.com/lxc/incus/issues/892
> > > Bisected-by: Stéphane Graber <[email protected]>
> > > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonicalcom>
> > > Tested-by: Stéphane Graber <[email protected]>
> > > ---
> >
> > Acked-by: Christian Brauner <[email protected]>
>
> Thanks a lot for the bisection and the fix !

Thanks, Eric!

>
> Reviewed-by: Eric Dumazet <[email protected]>

2024-05-30 02:00:51

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

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 <[email protected]>
> Closes: https://github.com/lxc/incus/issues/892
> Bisected-by: Stéphane Graber <[email protected]>
> Signed-off-by: Alexander Mikhalitsyn <[email protected]>
> Tested-by: Stéphane Graber <[email protected]>
>
> [...]

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