[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1453951563658.55708@alliedtelesis.co.nz>
Date: Thu, 28 Jan 2016 03:26:03 +0000
From: Bernie Harris <Bernie.Harris@...iedtelesis.co.nz>
To: Cong Wang <xiyou.wangcong@...il.com>
CC: Linux Kernel Network Developers <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Jamal Hadi Salim <jhs@...atatu.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH] net_sched: drr: check for NULL pointer in drr_dequeue
Thank you. I will add unlikely() and re-submit the patch.
________________________________________
From: Cong Wang <xiyou.wangcong@...il.com>
Sent: 27 January 2016 07:03
To: Bernie Harris
Cc: Linux Kernel Network Developers; David Miller; Jamal Hadi Salim; stable@...r.kernel.org
Subject: Re: [PATCH] net_sched: drr: check for NULL pointer in drr_dequeue
On Mon, Jan 25, 2016 at 7:51 PM, Bernie Harris
<bernie.harris@...iedtelesis.co.nz> wrote:
> There are cases where qdisc_dequeue_peeked can return NULL, and the result
> is dereferenced later on in the function.
>
> Similarly to the other qdisc dequeue functions, check whether the skb
> pointer is NULL and if it is, goto out.
>
> Signed-off-by: Bernie Harris <bernie.harris@...iedtelesis.co.nz>
Looks good to me, just one minor thing: an unlikely() can be used for this case.
> ---
> net/sched/sch_drr.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
> index f26bdea..8086c3d 100644
> --- a/net/sched/sch_drr.c
> +++ b/net/sched/sch_drr.c
> @@ -403,6 +403,8 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)
> if (len <= cl->deficit) {
> cl->deficit -= len;
> skb = qdisc_dequeue_peeked(cl->qdisc);
> + if (skb == NULL)
> + goto out;
> if (cl->qdisc->q.qlen == 0)
> list_del(&cl->alist);
>
> --
> 2.7.0
>
Powered by blists - more mailing lists