Skip to content

Commit

Permalink
qfq: don't leak skb if kzalloc fails
Browse files Browse the repository at this point in the history
When we need to create a new aggregate to enqueue the skb we call kzalloc.
If that fails we returned ENOBUFS without freeing the skb.

Spotted during code review.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Westphal authored and David S. Miller committed Jun 9, 2016
1 parent 0a46baa commit 9b15350
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/sched/sch_qfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,10 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid);
err = qfq_change_agg(sch, cl, cl->agg->class_weight,
qdisc_pkt_len(skb));
if (err)
return err;
if (err) {
cl->qstats.drops++;
return qdisc_drop(skb, sch);
}
}

err = qdisc_enqueue(skb, cl->qdisc);
Expand Down

0 comments on commit 9b15350

Please sign in to comment.