]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: dsa: rtl8366rb: Support all 4096 VLANs
authorLinus Walleij <linus.walleij@linaro.org>
Sun, 20 Sep 2020 20:37:33 +0000 (22:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:42 +0000 (10:07 +0100)
[ Upstream commit a7920efdd86d8a0d74402dbc80ead03b023294ba ]

There is an off-by-one error in rtl8366rb_is_vlan_valid()
making VLANs 0..4094 valid while it should be 1..4095.
Fix it.

Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/rtl8366rb.c

index fd1977590cb4b4f4dc174bef357c63e716b0dc82..c83b332656a4b6d7b35785c4427d65266a742ff3 100644 (file)
@@ -1270,7 +1270,7 @@ static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan)
        if (smi->vlan4k_enabled)
                max = RTL8366RB_NUM_VIDS - 1;
 
-       if (vlan == 0 || vlan >= max)
+       if (vlan == 0 || vlan > max)
                return false;
 
        return true;