From: Florian Westphal <fw@strlen.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Florian Westphal <fw@strlen.de>, netdev@vger.kernel.org
Subject: Re: [PATCH net] qfq: don't leak skb if kzalloc fails
Date: Wed, 8 Jun 2016 23:04:28 +0200 [thread overview]
Message-ID: <20160608210428.GE29699@breakpoint.cc> (raw)
In-Reply-To: <1465401273.7945.18.camel@edumazet-glaptop3.roam.corp.google.com>
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2016-06-08 at 14:31 +0200, Florian Westphal wrote:
> > When we need to create a new aggregate to enqueue the skb we need
> > to kzalloc the new struct.
> >
> > If that fails we returned ENOBUFS without freeing the skb.
> >
> > Spotted during code review.
> >
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> > ---
> > net/sched/sch_qfq.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
> > index 8d2d8d9..435b970 100644
> > --- a/net/sched/sch_qfq.c
> > +++ b/net/sched/sch_qfq.c
> > @@ -1236,7 +1236,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
> > err = qfq_change_agg(sch, cl, cl->agg->class_weight,
> > qdisc_pkt_len(skb));
> > if (err)
> > - return err;
> > + return qdisc_drop(skb, sch);
> > }
> >
> > err = qdisc_enqueue(skb, cl->qdisc);
>
> Good catch, but it looks like you forgot :
>
> cl->qstats.drops++;
Thanks, we have too many stats :-/
I'll send a v2, thanks!
prev parent reply other threads:[~2016-06-08 21:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 12:31 [PATCH net] qfq: don't leak skb if kzalloc fails Florian Westphal
2016-06-08 15:54 ` Eric Dumazet
2016-06-08 21:04 ` Florian Westphal [this message]
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=20160608210428.GE29699@breakpoint.cc \
--to=fw@strlen.de \
--cc=eric.dumazet@gmail.com \
--cc=netdev@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).