This is a note to let you know that I've just added the patch titled net: bridge: vlan: fix memory leak in __allowed_ingress to the 5.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-bridge-vlan-fix-memory-leak-in-__allowed_ingress.patch and it can be found in the queue-5.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 21ad90a1cfd6b2fd4aa691620cfbdaebe6a08132 Author: Tim Yi <tim.yi@xxxxxxxxx> Date: Thu Jan 27 15:49:53 2022 +0800 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@xxxxxxxxx> Acked-by: Nikolay Aleksandrov <nikolay@xxxxxxxxxx> Link: https://lore.kernel.org/r/20220127074953.12632-1-tim.yi@xxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index d0ebcc99bfa9d..f02351b4acaca 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);