]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: bridge: vlan: fix memory leak in __allowed_ingress
authorTim Yi <tim.yi@pica8.com>
Thu, 27 Jan 2022 07:49:53 +0000 (15:49 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 27 Jan 2022 17:01:25 +0000 (09:01 -0800)
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: 17b655fb80be ("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>
net/bridge/br_vlan.c

index 43201260e37b6ea4a11b8e497a721b6c0d4aab8e..1402d5ca242dc3d74c74b12d897efe56e6a92cb8 100644 (file)
@@ -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);