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

From: David Miller
Date: Tue Mar 26 2019 - 15:46:54 EST


From: Michal Kubecek <mkubecek@xxxxxxx>
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.