提交 d9351561 编写于 作者: E Eric Dumazet 提交者: David S. Miller

macvlan: fix panic if lowerdev in a bond

commit a35e2c1b (macvlan: use rx_handler_data pointer to store
macvlan_port pointer V2) added a bug in macvlan_port_create()

Steps to reproduce the bug:

# ifenslave bond0 eth0 eth1

# ip link add link eth0 up name eth0#1 type macvlan
->error EBUSY

# ip link add link eth0 up name eth0#1 type macvlan
->panic


Fix: Dont set IFF_MACVLAN_PORT in error case.
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7196cd6c
...@@ -585,8 +585,8 @@ static int macvlan_port_create(struct net_device *dev) ...@@ -585,8 +585,8 @@ static int macvlan_port_create(struct net_device *dev)
err = netdev_rx_handler_register(dev, macvlan_handle_frame, port); err = netdev_rx_handler_register(dev, macvlan_handle_frame, port);
if (err) if (err)
kfree(port); kfree(port);
else
dev->priv_flags |= IFF_MACVLAN_PORT; dev->priv_flags |= IFF_MACVLAN_PORT;
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册