summaryrefslogtreecommitdiff
path: root/net/bridge
diff options
context:
space:
mode:
authorTim Yi <tim.yi@pica8.com>2022-01-27 10:49:53 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-01 19:27:14 +0300
commitc5e216e880fa6f2cd9d4a6541269377657163098 (patch)
tree53ba38f48380115c8ee831c0ef0394f01312eccf /net/bridge
parent8861857ccc9dcfb7f30980f494689d517b75731d (diff)
downloadlinux-c5e216e880fa6f2cd9d4a6541269377657163098.tar.xz
net: bridge: vlan: fix memory leak in __allowed_ingress
[ Upstream commit fd20d9738395cf8e27d0a17eba34169699fccdff ] When using per-vlan state, if vlan snooping and stats are disabled, untagged or priority-tagged ingress frame will go to check pvid state. If the port state is forwarding and the pvid state is not learning/forwarding, untagged or priority-tagged frame will be dropped but skb memory is not freed. Should free skb when __allowed_ingress returns false. Fixes: a580c76d534c ("net: bridge: vlan: add per-vlan state") Signed-off-by: Tim Yi <tim.yi@pica8.com> Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com> Link: https://lore.kernel.org/r/20220127074953.12632-1-tim.yi@pica8.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_vlan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 06f5caee495a..10e63ea6a13e 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -560,10 +560,10 @@ static bool __allowed_ingress(const struct net_bridge *br,
!br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) {
if (*state == BR_STATE_FORWARDING) {
*state = br_vlan_get_pvid_state(vg);
- return br_vlan_state_allowed(*state, true);
- } else {
- return true;
+ if (!br_vlan_state_allowed(*state, true))
+ goto drop;
}
+ return true;
}
}
v = br_vlan_find(vg, *vid);