diff mbox series

[net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr()

Message ID 20240528203030.10839-1-aleksandr.mikhalitsyn@canonical.com (mailing list archive)
State Accepted
Commit b8c8abefc07b47f0dc9342530b7618237df96724
Delegated to: Netdev Maintainers
Headers show
Series [net] ipv4: correctly iterate over the target netns in inet_dump_ifaddr() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 45 this patch: 45
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang fail Errors and warnings before: 36 this patch: 36
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn fail Errors and warnings before: 45 this patch: 45
netdev/checkpatch warning WARNING: Non-standard signature: Bisected-by:
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0

Commit Message

Aleksandr Mikhalitsyn May 28, 2024, 8:30 p.m. UTC
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(-)

Comments

Christian Brauner May 29, 2024, 7:49 a.m. UTC | #1
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>
Eric Dumazet May 29, 2024, 8:29 a.m. UTC | #2
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>
Aleksandr Mikhalitsyn May 29, 2024, 8:52 a.m. UTC | #3
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>
patchwork-bot+netdevbpf@kernel.org May 30, 2024, 2 a.m. UTC | #4
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!
diff mbox series

Patch

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;