]> git.itanic.dy.fi Git - linux-stable/commit
net: fix removing a namespace with conflicting altnames
authorJakub Kicinski <kuba@kernel.org>
Fri, 19 Jan 2024 00:58:59 +0000 (16:58 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Jan 2024 01:09:30 +0000 (01:09 +0000)
commitd09486a04f5da0a812c26217213b89a3b1acf836
treee567450ae2501328105b5ebfc530f0b8b62f44f1
parent359724fa3ab79fbe9f42c6263cddc2afae32eef3
net: fix removing a namespace with conflicting altnames

Mark reports a BUG() when a net namespace is removed.

    kernel BUG at net/core/dev.c:11520!

Physical interfaces moved outside of init_net get "refunded"
to init_net when that namespace disappears. The main interface
name may get overwritten in the process if it would have
conflicted. We need to also discard all conflicting altnames.
Recent fixes addressed ensuring that altnames get moved
with the main interface, which surfaced this problem.

Reported-by: Марк Коренберг <socketpair@gmail.com>
Link: https://lore.kernel.org/all/CAEmTpZFZ4Sv3KwqFOY2WKDHeZYdi0O7N5H1nTvcGp=SAEavtDg@mail.gmail.com/
Fixes: 7663d522099e ("net: check for altname conflicts when changing netdev's netns")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c
net/core/dev.h