diff mbox series

[net-next] Revert "net-loopback: set lo dev initial state to UP"

Message ID 565e72d78de80b2db767d172691bb4b682c6f4fd.1612893026.git.petrm@nvidia.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net-next] Revert "net-loopback: set lo dev initial state to UP" | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 1 maintainers not CCed: kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Petr Machata Feb. 9, 2021, 5:52 p.m. UTC
In commit c9dca822c729 ("net-loopback: set lo dev initial state to UP"),
linux started automatically bringing up the loopback device of a newly
created namespace. However, an existing user script might reasonably have
the following stanza when creating a new namespace -- and in fact at least
tools/testing/selftests/net/fib_nexthops.sh in Linux's very own testsuite
does:

 # set -e
 # ip netns add foo
 # ip -netns foo addr add 127.0.0.1/8 dev lo
 # ip -netns foo link set lo up
 # set +e

This will now fail, because the kernel reasonably rejects "ip addr add" of
a duplicate address. The described change of behavior therefore constitutes
a breakage. Revert it.

Fixes: c9dca822c729 ("net-loopback: set lo dev initial state to UP")
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
 drivers/net/loopback.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Jakub Kicinski Feb. 9, 2021, 6:29 p.m. UTC | #1
On Tue, 9 Feb 2021 18:52:04 +0100 Petr Machata wrote:
> In commit c9dca822c729 ("net-loopback: set lo dev initial state to UP"),
> linux started automatically bringing up the loopback device of a newly
> created namespace. However, an existing user script might reasonably have
> the following stanza when creating a new namespace -- and in fact at least
> tools/testing/selftests/net/fib_nexthops.sh in Linux's very own testsuite
> does:
> 
>  # set -e
>  # ip netns add foo
>  # ip -netns foo addr add 127.0.0.1/8 dev lo
>  # ip -netns foo link set lo up
>  # set +e
> 
> This will now fail, because the kernel reasonably rejects "ip addr add" of
> a duplicate address. The described change of behavior therefore constitutes
> a breakage. Revert it.
> 
> Fixes: c9dca822c729 ("net-loopback: set lo dev initial state to UP")
> Signed-off-by: Petr Machata <petrm@nvidia.com>

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

Thanks!
diff mbox series

Patch

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 24487ec17f8b..a1c77cc00416 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -219,12 +219,6 @@  static __net_init int loopback_net_init(struct net *net)
 
 	BUG_ON(dev->ifindex != LOOPBACK_IFINDEX);
 	net->loopback_dev = dev;
-
-	/* bring loopback device UP */
-	rtnl_lock();
-	dev_open(dev, NULL);
-	rtnl_unlock();
-
 	return 0;
 
 out_free_netdev: