netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net
Subject: Re: [PATCH] net: fix checking boundary of valid vlan id
Date: Sun, 30 Dec 2012 14:39:42 +0800	[thread overview]
Message-ID: <20121230063942.GA22499@t430s.redhat.com> (raw)
In-Reply-To: <1356848931-22193-1-git-send-email-akong@redhat.com>

On Sun, Dec 30, 2012 at 02:28:51PM +0800, akong@redhat.com wrote:
> From: Amos Kong <akong@redhat.com>
> 
> 4096 is not a valid vlan id.
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  net/bridge/netfilter/ebt_vlan.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/netfilter/ebt_vlan.c b/net/bridge/netfilter/ebt_vlan.c
> index eae67bf..b279ec0 100644
> --- a/net/bridge/netfilter/ebt_vlan.c
> +++ b/net/bridge/netfilter/ebt_vlan.c
> @@ -121,8 +121,8 @@ static int ebt_vlan_mt_check(const struct xt_mtchk_param *par)
>  	 * if_vlan.h: VLAN_N_VID 4096. */
>  	if (GET_BITMASK(EBT_VLAN_ID)) {
>  		if (!!info->id) { /* if id!=0 => check vid range */
> -			if (info->id > VLAN_N_VID) {
> -				pr_debug("id %d is out of range (1-4096)\n",
> +			if (info->id >= VLAN_N_VID) {
> +				pr_debug("id %d is out of range (1-4095)\n",

Hi David,

4095 is reserved, treat it as invalid here?

   			if (info->id >= VLAN_N_VID - 1) {
   				pr_debug("id %d is out of range (1-4094)\n",


>  					 info->id);
>  				return -EINVAL;
>  			}
> -- 
> 1.7.11.7

  reply	other threads:[~2012-12-30  6:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-30  6:28 [PATCH] net: fix checking boundary of valid vlan id akong
2012-12-30  6:39 ` Amos Kong [this message]
2012-12-30  7:40 ` David Miller
2012-12-30 12:25 ` Florian Westphal
2012-12-31 11:36   ` Glen Turner
2012-12-31 17:12     ` Benny Amorsen
2012-12-31 22:30       ` Glen Turner
2013-01-03  0:39 ` Pablo Neira Ayuso
2013-01-03 20:06   ` Ben Hutchings

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=20121230063942.GA22499@t430s.redhat.com \
    --to=akong@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).