[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20161128075147.GA27667@office.localdomain>
Date: Mon, 28 Nov 2016 09:51:47 +0200
From: "Amir Vadai\"" <amir@...ai.me>
To: David Miller <davem@...emloft.net>
Cc: xiyou.wangcong@...il.com, netdev@...r.kernel.org, jhs@...atatu.com,
ogerlitz@...lanox.com, hadarh@...lanox.com, jiri@...lanox.com
Subject: Re: [PATCH net] net/sched: act_pedit: limit negative offset
On Mon, Nov 28, 2016 at 12:49:36AM -0500, David Miller wrote:
> From: Cong Wang <xiyou.wangcong@...il.com>
> Date: Sun, 27 Nov 2016 21:39:33 -0800
>
> > On Sun, Nov 27, 2016 at 7:58 AM, Amir Vadai <amir@...ai.me> wrote:
> >> Should not allow setting a negative offset that goes below the skb head.
> > ...
> >> diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
> >> index b54d56d4959b..e79e8a88f2d2 100644
> >> --- a/net/sched/act_pedit.c
> >> +++ b/net/sched/act_pedit.c
> >> @@ -154,8 +154,11 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
> >> }
> >>
> >> ptr = skb_header_pointer(skb, off + offset, 4, &_data);
> >> - if (!ptr)
> >> + if ((unsigned char *)ptr < skb->head) {
> >
> >
> > ptr returned could be &_data, which is on stack, so why this comparison
> > makes sense for this case?
>
> Indeed, this will definitely do the wrong thing when the on-stack area
> passed back to ptr.
yes - my bad. will correct it and send v1
Powered by blists - more mailing lists