From: Stephen Hemminger <shemminger-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
To: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
Cc: Tomas Winkler
<tomas.winkler-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH net-2.6] bridge: fix br_multicast_ipv6_rcv for paged skbs
Date: Thu, 30 Dec 2010 11:06:09 -0800 [thread overview]
Message-ID: <20101230110609.08b7ee38@nehalam> (raw)
In-Reply-To: <1293735134.21956.1.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org>
On Thu, 30 Dec 2010 19:52:14 +0100
Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
> On Thu, 2010-12-30 at 10:46 -0800, Stephen Hemminger wrote:
>
> > This doesn't look correct. The calculation of the offset doesn't look correct.
> > Just following the skb_clone(), the skb_pull value is "offset".
> > Also, the other checks return -EINVAL for incorrectly formed packet.
> >
> > --- a/net/bridge/br_multicast.c 2010-12-30 10:29:58.579510488 -0800
> > +++ b/net/bridge/br_multicast.c 2010-12-30 10:43:27.273386691 -0800
> > @@ -1464,6 +1464,9 @@ static int br_multicast_ipv6_rcv(struct
> > if (offset < 0 || nexthdr != IPPROTO_ICMPV6)
> > return 0;
> >
> > + if (!pskb_may_pull(skb, offset))
> > + return -EINVAL;
> > +
> > /* Okay, we found ICMPv6 header */
> > skb2 = skb_clone(skb, GFP_ATOMIC);
> > if (!skb2)
>
> Wouldn't that make more sense after the clone anyway? But if you look at
> my email, you'll find that there's potentially, and conditionally, more
> stuff that will be read from the skb's header, which hasn't necessarily
> been pulled in, so I think this still won't fix all the issues.
>
> Seeing how this only affects some ICMPv6 packets, maybe we should just
> use skb_copy() instead?
It comes out cleaner, and the check can be simplified.
--- a/net/bridge/br_multicast.c 2010-12-30 10:47:12.031733855 -0800
+++ b/net/bridge/br_multicast.c 2010-12-30 11:00:12.135801266 -0800
@@ -1465,19 +1465,19 @@ static int br_multicast_ipv6_rcv(struct
return 0;
/* Okay, we found ICMPv6 header */
- skb2 = skb_clone(skb, GFP_ATOMIC);
+ skb2 = skb_copy(skb, GFP_ATOMIC);
if (!skb2)
return -ENOMEM;
+ err = -EINVAL;
+ if (skb2->len < offset + sizeof(*icmp6h))
+ goto out;
+
len -= offset - skb_network_offset(skb2);
__skb_pull(skb2, offset);
skb_reset_transport_header(skb2);
- err = -EINVAL;
- if (!pskb_may_pull(skb2, sizeof(*icmp6h)))
- goto out;
next prev parent reply other threads:[~2010-12-30 19:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-16 12:11 BUG: while bridging Ethernet and wireless device: Tomas Winkler
[not found] ` <AANLkTikYvBspVmAZ0DCMXJ-3WxkotwX+n8NpTtM+97_i-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-16 12:16 ` Johannes Berg
[not found] ` <1292501797.3612.12.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2010-12-19 9:07 ` Tomas Winkler
2010-12-29 15:04 ` Johannes Berg
2010-12-29 16:12 ` Tomas Winkler
2010-12-30 11:32 ` [PATCH net-2.6] bridge: fix br_multicast_ipv6_rcv for paged skbs Tomas Winkler
2010-12-30 18:46 ` Stephen Hemminger
2010-12-30 18:52 ` Johannes Berg
[not found] ` <1293735134.21956.1.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2010-12-30 19:06 ` Stephen Hemminger [this message]
2010-12-30 21:00 ` Winkler, Tomas
-- strict thread matches above, loose matches on Subject: below --
2010-12-30 23:06 Stephen Hemminger
[not found] ` <9mk4bme8o97ir27xi8a9fbsd.1293750376929-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2010-12-30 23:29 ` Winkler, Tomas
[not found] ` <6F5C1D715B2DA5498A628E6B9C124F04019BF36ABD-KS4eWWg9cz+vNW/NfzhIbrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-12-31 10:18 ` Johannes Berg
2010-12-31 20:45 ` David Miller
2010-12-31 21:16 ` Winkler, Tomas
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=20101230110609.08b7ee38@nehalam \
--to=shemminger-ztmgi6mnkb3qt0dzr+alfa@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tomas.winkler-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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).