Skip to content

Commit

Permalink
[MACVLAN]: Prevent nesting macvlan devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jan 11, 2008
1 parent 0fe1e56 commit a6ca5f1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev,
if (lowerdev == NULL)
return -ENODEV;

/* Don't allow macvlans on top of other macvlans - its not really
* wrong, but lockdep can't handle it and its not useful for anything
* you couldn't do directly on top of the real device.
*/
if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
return -ENODEV;

if (!tb[IFLA_MTU])
dev->mtu = lowerdev->mtu;
else if (dev->mtu > lowerdev->mtu)
Expand Down

0 comments on commit a6ca5f1

Please sign in to comment.