* [Patch net] net_sched: fix a use-after-free in sfq
@ 2015-07-14 18:21 Cong Wang
2015-07-14 18:21 ` [Patch net] fq_codel: fix return value of fq_codel_drop() Cong Wang
2015-07-16 4:36 ` [Patch net] net_sched: fix a use-after-free in sfq David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Cong Wang @ 2015-07-14 18:21 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, John Fastabend, Cong Wang
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_sfq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 7d14926..52f75a5 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -306,10 +306,10 @@ static unsigned int sfq_drop(struct Qdisc *sch)
len = qdisc_pkt_len(skb);
slot->backlog -= len;
sfq_dec(q, x);
- kfree_skb(skb);
sch->q.qlen--;
qdisc_qstats_drop(sch);
qdisc_qstats_backlog_dec(sch, skb);
+ kfree_skb(skb);
return len;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Patch net] fq_codel: fix return value of fq_codel_drop()
2015-07-14 18:21 [Patch net] net_sched: fix a use-after-free in sfq Cong Wang
@ 2015-07-14 18:21 ` Cong Wang
2015-07-15 6:27 ` Eric Dumazet
2015-07-16 4:36 ` David Miller
2015-07-16 4:36 ` [Patch net] net_sched: fix a use-after-free in sfq David Miller
1 sibling, 2 replies; 5+ messages in thread
From: Cong Wang @ 2015-07-14 18:21 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, Eric Dumazet, Cong Wang
The ->drop() is supposed to return the number of bytes it dropped,
however fq_codel_drop() returns the index of the flow where it drops
a packet from.
Fix this by introducing a helper to wrap fq_codel_drop().
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
---
net/sched/sch_fq_codel.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 06e7c84..21ca33c 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -163,6 +163,15 @@ static unsigned int fq_codel_drop(struct Qdisc *sch)
return idx;
}
+static unsigned int fq_codel_qdisc_drop(struct Qdisc *sch)
+{
+ unsigned int prev_backlog;
+
+ prev_backlog = sch->qstats.backlog;
+ fq_codel_drop(sch);
+ return prev_backlog - sch->qstats.backlog;
+}
+
static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
struct fq_codel_sched_data *q = qdisc_priv(sch);
@@ -604,7 +613,7 @@ static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = {
.enqueue = fq_codel_enqueue,
.dequeue = fq_codel_dequeue,
.peek = qdisc_peek_dequeued,
- .drop = fq_codel_drop,
+ .drop = fq_codel_qdisc_drop,
.init = fq_codel_init,
.reset = fq_codel_reset,
.destroy = fq_codel_destroy,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Patch net] fq_codel: fix return value of fq_codel_drop()
2015-07-14 18:21 ` [Patch net] fq_codel: fix return value of fq_codel_drop() Cong Wang
@ 2015-07-15 6:27 ` Eric Dumazet
2015-07-16 4:36 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-07-15 6:27 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, Eric Dumazet, Cong Wang
On Tue, 2015-07-14 at 11:21 -0700, Cong Wang wrote:
> The ->drop() is supposed to return the number of bytes it dropped,
> however fq_codel_drop() returns the index of the flow where it drops
> a packet from.
>
> Fix this by introducing a helper to wrap fq_codel_drop().
>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Cong Wang <cwang@twopensource.com>
> ---
SGTM, thanks Cong.
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch net] net_sched: fix a use-after-free in sfq
2015-07-14 18:21 [Patch net] net_sched: fix a use-after-free in sfq Cong Wang
2015-07-14 18:21 ` [Patch net] fq_codel: fix return value of fq_codel_drop() Cong Wang
@ 2015-07-16 4:36 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-07-16 4:36 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, john.fastabend, cwang
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Tue, 14 Jul 2015 11:21:57 -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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch net] fq_codel: fix return value of fq_codel_drop()
2015-07-14 18:21 ` [Patch net] fq_codel: fix return value of fq_codel_drop() Cong Wang
2015-07-15 6:27 ` Eric Dumazet
@ 2015-07-16 4:36 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-07-16 4:36 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, edumazet, cwang
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Tue, 14 Jul 2015 11:21:58 -0700
> The ->drop() is supposed to return the number of bytes it dropped,
> however fq_codel_drop() returns the index of the flow where it drops
> a packet from.
>
> Fix this by introducing a helper to wrap fq_codel_drop().
>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Cong Wang <cwang@twopensource.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-16 4:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 18:21 [Patch net] net_sched: fix a use-after-free in sfq Cong Wang
2015-07-14 18:21 ` [Patch net] fq_codel: fix return value of fq_codel_drop() Cong Wang
2015-07-15 6:27 ` Eric Dumazet
2015-07-16 4:36 ` David Miller
2015-07-16 4:36 ` [Patch net] net_sched: fix a use-after-free in sfq David Miller
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).