All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
@ 2022-01-27  7:49 ` Tim Yi
  0 siblings, 0 replies; 6+ messages in thread
From: Tim Yi @ 2022-01-27  7:49 UTC (permalink / raw)
  To: nikolay; +Cc: roopa, davem, kuba, bridge, netdev, Tim Yi

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.

Signed-off-by: Tim Yi <tim.yi@pica8.com>
---
 net/bridge/br_vlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 84ba456a78cc..88c4297cddee 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);
-- 
2.28.0.618.g9bc233ae1c


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Bridge] [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
@ 2022-01-27  7:49 ` Tim Yi
  0 siblings, 0 replies; 6+ messages in thread
From: Tim Yi @ 2022-01-27  7:49 UTC (permalink / raw)
  To: nikolay; +Cc: Tim Yi, netdev, bridge, roopa, kuba, davem

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.

Signed-off-by: Tim Yi <tim.yi@pica8.com>
---
 net/bridge/br_vlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 84ba456a78cc..88c4297cddee 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);
-- 
2.28.0.618.g9bc233ae1c


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
  2022-01-27  7:49 ` [Bridge] " Tim Yi
@ 2022-01-27  8:03   ` Nikolay Aleksandrov
  -1 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2022-01-27  8:03 UTC (permalink / raw)
  To: Tim Yi; +Cc: roopa, davem, kuba, bridge, netdev

On 27/01/2022 09:49, Tim Yi wrote:
> 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.
> 
> Signed-off-by: Tim Yi <tim.yi@pica8.com>
> ---
>  net/bridge/br_vlan.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index 84ba456a78cc..88c4297cddee 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);



Good catch, also should go to stable, here's the appropriate fixes tag.

Fixes: a580c76d534c ("net: bridge: vlan: add per-vlan state")
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>

Thanks,
 Nik

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bridge] [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
@ 2022-01-27  8:03   ` Nikolay Aleksandrov
  0 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2022-01-27  8:03 UTC (permalink / raw)
  To: Tim Yi; +Cc: kuba, netdev, bridge, davem, roopa

On 27/01/2022 09:49, Tim Yi wrote:
> 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.
> 
> Signed-off-by: Tim Yi <tim.yi@pica8.com>
> ---
>  net/bridge/br_vlan.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index 84ba456a78cc..88c4297cddee 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);



Good catch, also should go to stable, here's the appropriate fixes tag.

Fixes: a580c76d534c ("net: bridge: vlan: add per-vlan state")
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>

Thanks,
 Nik

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
  2022-01-27  7:49 ` [Bridge] " Tim Yi
@ 2022-01-27 17:10   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-27 17:10 UTC (permalink / raw)
  To: Tim Yi; +Cc: nikolay, roopa, davem, kuba, bridge, netdev

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 27 Jan 2022 15:49:53 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - net: bridge: vlan: fix memory leak in __allowed_ingress
    https://git.kernel.org/netdev/net/c/fd20d9738395

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bridge] [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
@ 2022-01-27 17:10   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-27 17:10 UTC (permalink / raw)
  To: Tim Yi; +Cc: netdev, bridge, nikolay, roopa, kuba, davem

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 27 Jan 2022 15:49:53 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - net: bridge: vlan: fix memory leak in __allowed_ingress
    https://git.kernel.org/netdev/net/c/fd20d9738395

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-27 17:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27  7:49 [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress Tim Yi
2022-01-27  7:49 ` [Bridge] " Tim Yi
2022-01-27  8:03 ` Nikolay Aleksandrov
2022-01-27  8:03   ` [Bridge] " Nikolay Aleksandrov
2022-01-27 17:10 ` patchwork-bot+netdevbpf
2022-01-27 17:10   ` [Bridge] " patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.