Re: [PATCH net-next v5 01/22] rtnetlink: provide permanent hardware address in RTM_NEWLINK

David Miller
2019-03-26T19:46:53Z

From: Michal Kubecek <mkubecek@suse.cz>
Date: Mon, 25 Mar 2019 18:07:57 +0100 (CET)

> @@ -1683,6 +1684,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
> nla_put_s32(skb, IFLA_NEW_IFINDEX, new_ifindex) < 0)
> goto nla_put_failure;
>
> + if (nla_put(skb, IFLA_PERM_ADDRESS, dev->addr_len, dev->perm_addr))
> + goto nla_put_failure;
>
> rcu_read_lock();
> if (rtnl_fill_link_af(skb, dev, ext_filter_mask))

I guess, as Jiri says, we really do have to check if the driver
actually set this before pushing the attribute out to userspace.

But seriously, you chould just check for dev_addr_len zeros.

All zeros is not a valid link address on any link type.