Commit e824265d authored by Gao Feng's avatar Gao Feng Committed by David S. Miller

driver: macvtap: Unregister netdev rx_handler if macvtap_newlink fails

The macvtap_newlink registers the netdev rx_handler firstly, but it
does not unregister the handler if macvlan_common_newlink failed.
Signed-off-by: default avatarGao Feng <fgao@ikuai8.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a1cad5ee
...@@ -491,7 +491,13 @@ static int macvtap_newlink(struct net *src_net, ...@@ -491,7 +491,13 @@ static int macvtap_newlink(struct net *src_net,
/* Don't put anything that may fail after macvlan_common_newlink /* Don't put anything that may fail after macvlan_common_newlink
* because we can't undo what it does. * because we can't undo what it does.
*/ */
return macvlan_common_newlink(src_net, dev, tb, data); err = macvlan_common_newlink(src_net, dev, tb, data);
if (err) {
netdev_rx_handler_unregister(dev);
return err;
}
return 0;
} }
static void macvtap_dellink(struct net_device *dev, static void macvtap_dellink(struct net_device *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment