* [PATCH net-next] netem: fix possible NULL deref in netem_dequeue()
@ 2013-07-03 21:04 Eric Dumazet
2013-07-03 23:53 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2013-07-03 21:04 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Dan Carpenter
From: Eric Dumazet <edumazet@google.com>
commit aec0a40a6f7884 ("netem: use rb tree to implement the time queue")
added a regression if a child qdisc is attached to netem, as we perform
a NULL dereference.
Fix this by adding a temporary variable to cache
netem_skb_cb(skb)->time_to_send.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/sched/sch_netem.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index ed0082c..ca4a5d5 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -554,10 +554,13 @@ deliver:
}
p = rb_first(&q->t_root);
if (p) {
+ psched_time_t time_to_send;
+
skb = netem_rb_to_skb(p);
/* if more time remaining? */
- if (netem_skb_cb(skb)->time_to_send <= psched_get_time()) {
+ time_to_send = netem_skb_cb(skb)->time_to_send;
+ if (time_to_send <= psched_get_time()) {
rb_erase(p, &q->t_root);
sch->q.qlen--;
@@ -593,8 +596,7 @@ deliver:
if (skb)
goto deliver;
}
- qdisc_watchdog_schedule(&q->watchdog,
- netem_skb_cb(skb)->time_to_send);
+ qdisc_watchdog_schedule(&q->watchdog, time_to_send);
}
if (q->qdisc) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] netem: fix possible NULL deref in netem_dequeue()
2013-07-03 21:04 [PATCH net-next] netem: fix possible NULL deref in netem_dequeue() Eric Dumazet
@ 2013-07-03 23:53 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-07-03 23:53 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, dan.carpenter
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 03 Jul 2013 14:04:14 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> commit aec0a40a6f7884 ("netem: use rb tree to implement the time queue")
> added a regression if a child qdisc is attached to netem, as we perform
> a NULL dereference.
>
> Fix this by adding a temporary variable to cache
> netem_skb_cb(skb)->time_to_send.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-03 23:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-03 21:04 [PATCH net-next] netem: fix possible NULL deref in netem_dequeue() Eric Dumazet
2013-07-03 23:53 ` 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).