From 85e2bf2a2cb55526065c288eb1fcfda74fd0a6fa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 23 Nov 2021 12:24:50 +0100 Subject: [PATCH] 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 --- subsys/net/l2/ethernet/ethernet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/ethernet/ethernet.c b/subsys/net/l2/ethernet/ethernet.c index 8e0a83388c6..295308805f9 100644 --- a/subsys/net/l2/ethernet/ethernet.c +++ b/subsys/net/l2/ethernet/ethernet.c @@ -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; }