From: Alexander Aring Date: Sun, 2 Nov 2014 03:18:46 +0000 (+0100) Subject: mac802154: iface: add validation for extended address X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea7053c1df41689dea0db2c49dc9d25dbe8fcf33;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mac802154: iface: add validation for extended address This patch use the validation function to check if an extended address is valid or not while set the extended address. Signed-off-by: Alexander Aring Signed-off-by: Marcel Holtmann --- diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c index eaad66590f10..ceedf3ef1ce2 100644 --- a/net/mac802154/iface.c +++ b/net/mac802154/iface.c @@ -112,13 +112,17 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p) { struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); struct sockaddr *addr = p; + __le64 extended_addr; if (netif_running(dev)) return -EBUSY; - /* FIXME: validate addr */ + extended_addr = ieee802154_netdev_to_extended_addr(addr->sa_data); + if (!ieee802154_is_valid_extended_addr(extended_addr)) + return -EINVAL; + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); - sdata->extended_addr = ieee802154_netdev_to_extended_addr(dev->dev_addr); + sdata->extended_addr = extended_addr; return mac802154_wpan_update_llsec(dev); }