Message ID | 20240819071229.2489506-12-shaojijie@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add support of HIBMCGE Ethernet Driver | expand |
diff --git a/net/core/dev.c b/net/core/dev.c index 751d9b70e6ad..ad86b8c939c1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9087,6 +9087,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa, return -EOPNOTSUPP; if (sa->sa_family != dev->type) return -EINVAL; + if (!is_valid_ether_addr(sa->sa_data)) + return -EADDRNOTAVAIL; if (!netif_device_present(dev)) return -ENODEV; err = dev_pre_changeaddr_notify(dev, sa->sa_data, extack);
core need test the mac_addr not every driver need to do. Signed-off-by: Jijie Shao <shaojijie@huawei.com> --- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)