From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Bernie Harris <bernie.harris@alliedtelesis.co.nz>,
netdev@vger.kernel.org
Cc: davem@davemloft.net, jhs@mojatatu.com, stable@vger.kernel.org
Subject: Re: [PATCH] net_sched: drr: check for NULL pointer in drr_dequeue
Date: Thu, 28 Jan 2016 17:04:19 +0300 [thread overview]
Message-ID: <56AA1FE3.6060201@cogentembedded.com> (raw)
In-Reply-To: <1453951851-24501-1-git-send-email-bernie.harris@alliedtelesis.co.nz>
Hello.
On 1/28/2016 6:30 AM, Bernie Harris 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@alliedtelesis.co.nz>
> ---
> 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..a1cd778 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 (unlikely(skb == NULL))
!skb is preferred in the networking code. I think scripts/checkpatch.pl
should've warned you.
[...]
MBR, Sergei
next prev parent reply other threads:[~2016-01-28 14:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 3:51 [PATCH] net_sched: drr: check for NULL pointer in drr_dequeue Bernie Harris
2016-01-26 18:03 ` Cong Wang
2016-01-28 3:26 ` Bernie Harris
2016-01-28 3:30 ` Bernie Harris
2016-01-28 14:04 ` Sergei Shtylyov [this message]
2016-01-29 18:19 ` Cong Wang
2016-01-30 1:27 ` 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=56AA1FE3.6060201@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=bernie.harris@alliedtelesis.co.nz \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.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).