macvlan: fix panic if lowerdev in a bond

commit a35e2c1b6d (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: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2011-05-20 14:59:23 -04:00 committed by David S. Miller
parent 7196cd6c3d
commit d93515611b
1 changed files with 2 additions and 2 deletions

View File

@ -585,8 +585,8 @@ static int macvlan_port_create(struct net_device *dev)
err = netdev_rx_handler_register(dev, macvlan_handle_frame, port);
if (err)
kfree(port);
dev->priv_flags |= IFF_MACVLAN_PORT;
else
dev->priv_flags |= IFF_MACVLAN_PORT;
return err;
}