[MACVLAN]: Prevent nesting macvlan devices

Don't allow to nest macvlan devices since it will cause lockdep
warnings and isn't really useful for anything.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Patrick McHardy and committed by David S. Miller a6ca5f1d 0fe1e567

+7
+7
drivers/net/macvlan.c
··· 384 if (lowerdev == NULL) 385 return -ENODEV; 386 387 if (!tb[IFLA_MTU]) 388 dev->mtu = lowerdev->mtu; 389 else if (dev->mtu > lowerdev->mtu)
··· 384 if (lowerdev == NULL) 385 return -ENODEV; 386 387 + /* Don't allow macvlans on top of other macvlans - its not really 388 + * wrong, but lockdep can't handle it and its not useful for anything 389 + * you couldn't do directly on top of the real device. 390 + */ 391 + if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) 392 + return -ENODEV; 393 + 394 if (!tb[IFLA_MTU]) 395 dev->mtu = lowerdev->mtu; 396 else if (dev->mtu > lowerdev->mtu)