From: Stephen Hemminger <shemminger@vyatta.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 1/4] net: check for reference outside of skb
Date: Mon, 2 Aug 2010 16:21:58 -0700 [thread overview]
Message-ID: <20100802162158.0b0c6e70@nehalam> (raw)
In-Reply-To: <AANLkTi=8+xRJn_26740uKuWdgA=XvyB7-hgGT9dxjOXr@mail.gmail.com>
On Tue, 3 Aug 2010 07:11:14 +0800
Changli Gao <xiaosuo@gmail.com> wrote:
> On Tue, Aug 3, 2010 at 6:00 AM, Stephen Hemminger <shemminger@vyatta.com> wrote:
> > It is legitimate for callers of skb_header_pointer to pass a negative
> > offset, but the resulting pointer should not go outside the valid
> > range of data in the skb.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> > --- a/include/linux/skbuff.h 2010-08-01 09:23:01.635121262 -0700
> > +++ b/include/linux/skbuff.h 2010-08-01 09:25:27.453901530 -0700
> > @@ -1853,6 +1853,9 @@ static inline void *skb_header_pointer(c
> > {
> > int hlen = skb_headlen(skb);
> >
> > + if (hlen + offset < 0)
> > + return NULL;
> > +
>
> It seems wrong. do you mean
>
> if (skb_headroom(hlen) + offset < 0)
>
> Nevertheless it is also wrong. skb_header_pointer doesn't know if the
> headroom is filled with valid data or not.
>
It should be headroom. It is okay if the request is looking at PAD
area, that is the callers problem. Just don't want wander off into
into unallocated space.
Anyway, I'll fix it in cls_u32.
next prev parent reply other threads:[~2010-08-02 23:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-02 22:00 [PATCH 0/4] u32 classifier fixes Stephen Hemminger
2010-08-02 22:00 ` [PATCH 1/4] net: check for reference outside of skb Stephen Hemminger
2010-08-02 22:59 ` David Miller
2010-08-02 23:11 ` Changli Gao
2010-08-02 23:21 ` Stephen Hemminger [this message]
2010-08-02 23:25 ` Changli Gao
2010-08-02 22:00 ` [PATCH 2/4] net: add likely/unlikely to skb_header_pointer Stephen Hemminger
2010-08-02 22:00 ` [PATCH 3/4] u32: allow negative offset Stephen Hemminger
2010-08-02 22:00 ` [PATCH 4/4] u32: use get_unaligned_be32 Stephen Hemminger
2010-08-02 22:34 ` Changli Gao
2010-08-02 22:45 ` Stephen Hemminger
2010-08-02 22:55 ` Ben Hutchings
2010-08-02 23:01 ` Changli Gao
2010-08-02 23:44 ` [PATCH] u32: negative offset fix Stephen Hemminger
2010-08-03 5:08 ` 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=20100802162158.0b0c6e70@nehalam \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=xiaosuo@gmail.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 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).