diff mbox

[net] fq_codel: fix a use-after-free

Message ID 1436815807-25359-1-git-send-email-xiyou.wangcong@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Cong Wang July 13, 2015, 7:30 p.m. UTC
Fixes: 25331d6ce42b ("net: sched: implement qstat helper routines")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
---
 net/sched/sch_fq_codel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet July 14, 2015, 6:23 a.m. UTC | #1
On Mon, 2015-07-13 at 12:30 -0700, Cong Wang wrote:
> Fixes: 25331d6ce42b ("net: sched: implement qstat helper routines")
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Cong Wang <cwang@twopensource.com>
> ---
>  net/sched/sch_fq_codel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> index d75993f..06e7c84 100644
> --- a/net/sched/sch_fq_codel.c
> +++ b/net/sched/sch_fq_codel.c
> @@ -155,10 +155,10 @@ static unsigned int fq_codel_drop(struct Qdisc *sch)
>  	skb = dequeue_head(flow);
>  	len = qdisc_pkt_len(skb);
>  	q->backlogs[idx] -= len;
> -	kfree_skb(skb);
>  	sch->q.qlen--;
>  	qdisc_qstats_drop(sch);
>  	qdisc_qstats_backlog_dec(sch, skb);
> +	kfree_skb(skb);
>  	flow->dropped++;
>  	return idx;
>  }

Thanks Cong

Acked-by: Eric Dumazet <edumazet@google.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller July 16, 2015, 12:20 a.m. UTC | #2
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 13 Jul 2015 12:30:07 -0700

> Fixes: 25331d6ce42b ("net: sched: implement qstat helper routines")
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Cong Wang <cwang@twopensource.com>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index d75993f..06e7c84 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -155,10 +155,10 @@  static unsigned int fq_codel_drop(struct Qdisc *sch)
 	skb = dequeue_head(flow);
 	len = qdisc_pkt_len(skb);
 	q->backlogs[idx] -= len;
-	kfree_skb(skb);
 	sch->q.qlen--;
 	qdisc_qstats_drop(sch);
 	qdisc_qstats_backlog_dec(sch, skb);
+	kfree_skb(skb);
 	flow->dropped++;
 	return idx;
 }