All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@nvidia.com>
To: Tim Yi <tim.yi@pica8.com>
Cc: <roopa@nvidia.com>, <davem@davemloft.net>, <kuba@kernel.org>,
	<bridge@lists.linux-foundation.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
Date: Thu, 27 Jan 2022 10:03:30 +0200	[thread overview]
Message-ID: <fc5450f0-5d60-ac5c-03dd-e42507a52465@nvidia.com> (raw)
In-Reply-To: <20220127074953.12632-1-tim.yi@pica8.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Nikolay Aleksandrov <nikolay@nvidia.com>
To: Tim Yi <tim.yi@pica8.com>
Cc: kuba@kernel.org, netdev@vger.kernel.org,
	bridge@lists.linux-foundation.org, davem@davemloft.net,
	roopa@nvidia.com
Subject: Re: [Bridge] [PATCH] net: bridge: vlan: fix memory leak in __allowed_ingress
Date: Thu, 27 Jan 2022 10:03:30 +0200	[thread overview]
Message-ID: <fc5450f0-5d60-ac5c-03dd-e42507a52465@nvidia.com> (raw)
In-Reply-To: <20220127074953.12632-1-tim.yi@pica8.com>

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

  reply	other threads:[~2022-01-27  8:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-01-27  8:03   ` Nikolay Aleksandrov
2022-01-27 17:10 ` patchwork-bot+netdevbpf
2022-01-27 17:10   ` [Bridge] " patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc5450f0-5d60-ac5c-03dd-e42507a52465@nvidia.com \
    --to=nikolay@nvidia.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@nvidia.com \
    --cc=tim.yi@pica8.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.