netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@web.de>
To: bridge@lists.linux-foundation.org
Cc: "Stephen Hemminger" <shemminger@linux-foundation.org>,
	"David Miller" <davem@davemloft.net>,
	"YOSHIFUJI Hideaki" <yoshfuji@linux-ipv6.org>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	netdev@vger.kernel.org, "Linus Lüssing" <linus.luessing@web.de>
Subject: [PATCH] bridge: mcast snooping, fix length check of snooped MLDv1/2
Date: Sun, 27 Mar 2011 08:27:24 +0200	[thread overview]
Message-ID: <1301207244-10428-3-git-send-email-linus.luessing@web.de> (raw)
In-Reply-To: <1301207244-10428-1-git-send-email-linus.luessing@web.de>

"len = ntohs(ip6h->payload_len)" does not include the length of the ipv6
header itself, which the rest of this function assumes, though.

This leads to a length check less restrictive as it should be in the
following line for one thing. For another, it very likely leads to an
integer underrun when substracting the offset and therefore to a very
high new value of 'len' due to its unsignedness. This will ultimately
lead to the pskb_trim_rcsum() practically never being called, even in
the cases where it should.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
 net/bridge/br_multicast.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 47fae4f..3793264 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1475,7 +1475,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
 	    ip6h->payload_len == 0)
 		return 0;
 
-	len = ntohs(ip6h->payload_len);
+	len = ntohs(ip6h->payload_len) + sizeof(*ip6h);
 	if (skb->len < len)
 		return -EINVAL;
 
-- 
1.5.6.5


  parent reply	other threads:[~2011-03-27  6:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27  3:44 Checksumming bug in bridge multicast snooping for IPv6? Linus Lüssing
2011-03-27  6:27 ` bridge: mcast snooping, fixes for IPv6 MLDv1/2 parsing Linus Lüssing
2011-03-27  6:27   ` [PATCH] bridge: mcast snooping, fix IPv6 MLD checksum calculation Linus Lüssing
2011-03-27  6:37     ` Herbert Xu
2011-03-27  7:06       ` Linus Lüssing
2011-03-27  7:52         ` Herbert Xu
2011-03-30  9:29     ` David Miller
2011-03-27  6:27   ` Linus Lüssing [this message]
2011-03-30  9:30     ` [PATCH] bridge: mcast snooping, fix length check of snooped MLDv1/2 David Miller

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=1301207244-10428-3-git-send-email-linus.luessing@web.de \
    --to=linus.luessing@web.de \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    --cc=yoshfuji@linux-ipv6.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).