forked from Minki/linux
net: sched: Fix use after free in red_enqueue()
We can't use "skb" again after passing it to qdisc_enqueue(). This is basically identical to commit2f09707d0c
("sch_sfb: Also store skb len before calling child enqueue"). Fixes:d7f4f332f0
("sch_red: update backlog as well") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
06a4df5863
commit
8bdc2acd42
@ -72,6 +72,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
|||||||
{
|
{
|
||||||
struct red_sched_data *q = qdisc_priv(sch);
|
struct red_sched_data *q = qdisc_priv(sch);
|
||||||
struct Qdisc *child = q->qdisc;
|
struct Qdisc *child = q->qdisc;
|
||||||
|
unsigned int len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
q->vars.qavg = red_calc_qavg(&q->parms,
|
q->vars.qavg = red_calc_qavg(&q->parms,
|
||||||
@ -126,9 +127,10 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
len = qdisc_pkt_len(skb);
|
||||||
ret = qdisc_enqueue(skb, child, to_free);
|
ret = qdisc_enqueue(skb, child, to_free);
|
||||||
if (likely(ret == NET_XMIT_SUCCESS)) {
|
if (likely(ret == NET_XMIT_SUCCESS)) {
|
||||||
qdisc_qstats_backlog_inc(sch, skb);
|
sch->qstats.backlog += len;
|
||||||
sch->q.qlen++;
|
sch->q.qlen++;
|
||||||
} else if (net_xmit_drop_count(ret)) {
|
} else if (net_xmit_drop_count(ret)) {
|
||||||
q->stats.pdrop++;
|
q->stats.pdrop++;
|
||||||
|
Loading…
Reference in New Issue
Block a user