net: add check for current MAC address in dev_set_mac_address
authorPiotr Gardocki <piotrx.gardocki@intel.com>
Wed, 14 Jun 2023 14:53:00 +0000 (16:53 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 16 Jun 2023 05:54:54 +0000 (22:54 -0700)
commitad72c4a06acc6762e84994ac2f722da7a07df34e
tree2c5e36320dfce7748106c59d70909a61e6260953
parent8f72fb1578a910571b3f25457e3b7855edfac6cf
net: add check for current MAC address in dev_set_mac_address

In some cases it is possible for kernel to come with request
to change primary MAC address to the address that is already
set on the given interface.

Add proper check to return fast from the function in these cases.

An example of such case is adding an interface to bonding
channel in balance-alb mode:
modprobe bonding mode=balance-alb miimon=100 max_bonds=1
ip link set bond0 up
ifenslave bond0 <eth>

Signed-off-by: Piotr Gardocki <piotrx.gardocki@intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c