net: ethernet: Fix vlan tag verification

`net_eth_vlan_enable()` allowed to use illegal vlan tag values, fix this
by disallowing any tag value higher or equal to 0xfff (which is a limit
for the tag and a reserved value).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2021-11-23 12:24:50 +01:00 committed by Anas Nashif
commit 85e2bf2a2c

View file

@ -941,7 +941,7 @@ int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
return -EPERM;
}
if (tag == NET_VLAN_TAG_UNSPEC) {
if (tag >= NET_VLAN_TAG_UNSPEC) {
return -EBADF;
}