linux-stable/net
Jakub Kicinski 673edcffa0 net: check for altname conflicts when changing netdev's netns
commit 7663d52209 upstream.

It's currently possible to create an altname conflicting
with an altname or real name of another device by creating
it in another netns and moving it over:

 [ ~]$ ip link add dev eth0 type dummy

 [ ~]$ ip netns add test
 [ ~]$ ip -netns test link add dev ethX netns test type dummy
 [ ~]$ ip -netns test link property add dev ethX altname eth0
 [ ~]$ ip -netns test link set dev ethX netns 1

 [ ~]$ ip link
 ...
 3: eth0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ether 02:40:88:62:ec:b8 brd ff:ff:ff:ff:ff:ff
 ...
 5: ethX: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
     link/ether 26:b7:28:78:38:0f brd ff:ff:ff:ff:ff:ff
     altname eth0

Create a macro for walking the altnames, this hopefully makes
it clearer that the list we walk contains only altnames.
Which is otherwise not entirely intuitive.

Fixes: 36fbf1e52b ("net: rtnetlink: add linkprop commands to add and delete alternative ifnames")
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25 12:03:08 +02:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth
bpf
bpfilter
bridge
caif
can
ceph
core net: check for altname conflicts when changing netdev's netns 2023-10-25 12:03:08 +02:00
dcb
dccp
devlink
dns_resolver
dsa
ethernet
ethtool
hsr
ieee802154
ife
ipv4 ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr 2023-10-25 12:03:07 +02:00
ipv6 net: ipv6: fix return value check in esp_remove_trailer 2023-10-25 12:03:06 +02:00
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211
mac802154
mctp
mpls
mptcp
ncsi
netfilter netfilter: nf_tables: revert do not remove elements if set backend implements .abort 2023-10-25 12:03:07 +02:00
netlabel
netlink
netrom
nfc
nsh
openvswitch
packet
phonet
psample
qrtr
rds
rfkill net: rfkill: gpio: prevent value glitch during probe 2023-10-25 12:03:06 +02:00
rose
rxrpc
sched net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve 2023-10-25 12:03:07 +02:00
sctp
smc
strparser
sunrpc
switchdev
tipc
tls
unix
vmw_vsock
wireless wifi: cfg80211: use system_unbound_wq for wiphy work 2023-10-25 12:03:06 +02:00
x25
xdp
xfrm xfrm: interface: use DEV_STATS_INC() 2023-10-25 12:03:06 +02:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile
socket.c
sysctl_net.c