Skip to content

Commit b64085b

Browse files
edumazetdavem330
authored andcommitted
macvlan: enforce a consistent minimal mtu
macvlan should enforce a minimal mtu of 68, even at link creation. This patch avoids the current behavior (which could lead to crashes in ipv6 stack if the link is brought up) $ ip link add macvlan1 link eno1 mtu 8 type macvlan # This should fail ! $ ip link sh dev macvlan1 5: macvlan1@eno1: <BROADCAST,MULTICAST> mtu 8 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 02:47:6c:24:74:82 brd ff:ff:ff:ff:ff:ff $ ip link set macvlan1 mtu 67 Error: mtu less than device minimum. $ ip link set macvlan1 mtu 68 $ ip link set macvlan1 mtu 8 Error: mtu less than device minimum. Fixes: 9157208 ("net: use core MTU range checking in core net infra") Reported-by: syzbot <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 175302f commit b64085b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/macvlan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ void macvlan_common_setup(struct net_device *dev)
11921192
{
11931193
ether_setup(dev);
11941194

1195-
dev->min_mtu = 0;
1195+
/* ether_setup() has set dev->min_mtu to ETH_MIN_MTU. */
11961196
dev->max_mtu = ETH_MAX_MTU;
11971197
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
11981198
netif_keep_dst(dev);

0 commit comments

Comments
 (0)