From: Mahesh Bandewar Date: Sat, 6 Dec 2014 23:53:46 +0000 (-0800) Subject: macvlan: play well with ipvlan device X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d6b00fec5dbbe976904b4d77e7d4f9493df5c2ec;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git macvlan: play well with ipvlan device If device is already used as an ipvlan port then refuse to use it as a macvlan port at early stage of port creation. thost1:~# ip link add link eth0 ipvl0 type ipvlan thost1:~# echo $? 0 thost1:~# ip link add link eth0 mvl0 type macvlan RTNETLINK answers: Device or resource busy thost1:~# echo $? 2 thost1:~# Signed-off-by: Mahesh Bandewar Signed-off-by: David S. Miller --- diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 10604db2a3a0..612e0731142d 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1057,6 +1057,9 @@ static int macvlan_port_create(struct net_device *dev) if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK) return -EINVAL; + if (netif_is_ipvlan_port(dev)) + return -EBUSY; + port = kzalloc(sizeof(*port), GFP_KERNEL); if (port == NULL) return -ENOMEM;