[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200518052755.27467-1-dknightjun@gmail.com>
Date: Mon, 18 May 2020 13:27:55 +0800
From: Huang Qijun <dknightjun@...il.com>
To: davem@...emloft.net
Cc: kuba@...nel.org, ap420073@...il.com, tglx@...utronix.de,
gregkh@...uxfoundation.org, allison@...utok.net,
dknightjun@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] vlan: fix the bug that cannot create vlan4095
According to the 8021q standard, the VLAN id range is 1 to 4095.
But in the register_vlan_device function, the range is 1 to 4094,
because ">= VLAN_VID_MASK" is used to determine whether the id
is illegal. This will prevent the creation of the vlan4095 interface:
$ vconfig add sit0 4095
vconfig: ioctl error for add: Numerical result out of range
To fix this error, this patch uses ">= VLAN_N_VID" instead to
determine if the id is illegal.
Signed-off-by: Huang Qijun <dknightjun@...il.com>
---
net/8021q/vlan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index d4bcfd8f95bf..5de7861ddf64 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -219,7 +219,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
char name[IFNAMSIZ];
int err;
- if (vlan_id >= VLAN_VID_MASK)
+ if (vlan_id >= VLAN_N_VID)
return -ERANGE;
err = vlan_check_real_dev(real_dev, htons(ETH_P_8021Q), vlan_id,
--
2.17.1
Powered by blists - more mailing lists