Following commit 59f997b088d2 ("macvlan: return correct error value"), there is a duplicate check for mac addresses both in macvlan_sync_address() and macvlan_set_mac_address(). As the former calls the latter, remove the one in macvlan_set_mac_address() and move the one in macvlan_sync_address() before any other check.
Signed-off-by: Matteo Croce <mcr...@redhat.com> --- drivers/net/macvlan.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 0da3d36b283b..f3361aabdb78 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -700,14 +700,14 @@ static int macvlan_sync_address(struct net_device *dev, unsigned char *addr) struct macvlan_port *port = vlan->port; int err; + if (macvlan_addr_busy(vlan->port, addr)) + return -EADDRINUSE; + if (!(dev->flags & IFF_UP)) { /* Just copy in the new address */ ether_addr_copy(dev->dev_addr, addr); } else { /* Rehash and update the device filters */ - if (macvlan_addr_busy(vlan->port, addr)) - return -EADDRINUSE; - if (!macvlan_passthru(port)) { err = dev_uc_add(lowerdev, addr); if (err) @@ -747,9 +747,6 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p) return dev_set_mac_address(vlan->lowerdev, addr); } - if (macvlan_addr_busy(vlan->port, addr->sa_data)) - return -EADDRINUSE; - return macvlan_sync_address(dev, addr->sa_data); } -- 2.19.2