netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Karn <karn@ka9q.net>
To: kaber@trash.net
Cc: netdev@vger.kernel.org
Subject: Off-by-one error in net/8021q/vlan.c
Date: Wed, 16 Feb 2011 02:58:23 -0800	[thread overview]
Message-ID: <4D5BADCF.5000804@ka9q.net> (raw)

The range check on vlan_id in register_vlan_device is off by one, and it
prevents the creation of a vlan interface for vlan ID 4095. (OSX allows
this, I checked.)

Here's the trivial patch:

--- linux-2.6.37/net/8021q/vlan.c~	2011-01-04 16:50:19.000000000 -0800
+++ linux-2.6.37/net/8021q/vlan.c	2011-02-16 02:43:13.988812958 -0800
@@ -239,7 +239,7 @@
 	char name[IFNAMSIZ];
 	int err;

-	if (vlan_id >= VLAN_VID_MASK)
+	if (vlan_id > VLAN_VID_MASK)
 		return -ERANGE;

 	err = vlan_check_real_dev(real_dev, vlan_id);

             reply	other threads:[~2011-02-16 10:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 10:58 Phil Karn [this message]
2011-02-16 12:51 ` Off-by-one error in net/8021q/vlan.c richard -rw- weinberger
2011-02-16 13:22   ` Patrick McHardy
2011-02-16 15:58   ` Phil Karn
2011-02-16 16:10     ` richard -rw- weinberger
2011-02-16 16:28       ` Phil Karn
2011-02-16 16:35         ` richard -rw- weinberger
2011-02-16 16:39         ` Eric Dumazet
2011-02-16 18:41           ` Michał Mirosław
2011-02-21 19:26             ` Brent Cook
2011-02-21 21:47               ` Phil Karn

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=4D5BADCF.5000804@ka9q.net \
    --to=karn@ka9q.net \
    --cc=kaber@trash.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).