summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-02 04:18:46 +0100
committerMarcel Holtmann <marcel@holtmann.org>2014-11-02 04:51:08 +0100
commitea7053c1df41689dea0db2c49dc9d25dbe8fcf33 (patch)
treeb50caff2ea41a25ad86953b1fb53cef5aa90c9cd /net
parentcb904b0a16305f9b2a98200cc6eb9dc3610278b0 (diff)
downloadop-kernel-dev-ea7053c1df41689dea0db2c49dc9d25dbe8fcf33.zip
op-kernel-dev-ea7053c1df41689dea0db2c49dc9d25dbe8fcf33.tar.gz
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 <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/mac802154/iface.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index eaad665..ceedf3e 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);
}
OpenPOWER on IntegriCloud