Return-Path: Received: from mail-sn1nam02on0130.outbound.protection.outlook.com ([104.47.36.130]:38544 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933298AbeDIAk0 (ORCPT ); Sun, 8 Apr 2018 20:40:26 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Vlad Yasevich , Vladislav Yasevich , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 045/101] macvlan: Do not return error when setting the same mac address Date: Mon, 9 Apr 2018 00:35:55 +0000 Message-ID: <20180409003505.164715-45-alexander.levin@microsoft.com> References: <20180409003505.164715-1-alexander.levin@microsoft.com> In-Reply-To: <20180409003505.164715-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Vlad Yasevich [ Upstream commit e26f43faa0d79dd06e9e94829696b68b9940c2ee ] The user currently gets an EBUSY error when attempting to set the mac address on a macvlan device to the same value. This should really be a no-op as nothing changes. Catch the condition and return early. Signed-off-by: Vladislav Yasevich Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/macvlan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index c0818ec3d427..fe7b49cbfba5 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -681,6 +681,10 @@ static int macvlan_set_mac_address(struct net_device *= dev, void *p) if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; =20 + /* If the addresses are the same, this is a no-op */ + if (ether_addr_equal(dev->dev_addr, addr->sa_data)) + return 0; + if (vlan->mode =3D=3D MACVLAN_MODE_PASSTHRU) { dev_set_mac_address(vlan->lowerdev, addr); return 0; --=20 2.15.1