netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pkt_sched: Fix oops in htb_delete.
@ 2008-08-13 20:13 Jarek Poplawski
  2008-08-13 22:16 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jarek Poplawski @ 2008-08-13 20:13 UTC (permalink / raw)
  To: David Miller; +Cc: Patrick McHardy, netdev

pkt_sched: Fix oops in htb_delete.

Recent changes introduced a bug in htb_delete(): cl->parent->children
counter update misses checking cl->parent for NULL, which is used for
root classes, so deleting them causes an oops.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

---

 net/sched/sch_htb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index be35422..6febd24 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1279,7 +1279,8 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
 
 	/* delete from hash and active; remainder in destroy_class */
 	qdisc_class_hash_remove(&q->clhash, &cl->common);
-	cl->parent->children--;
+	if (cl->parent)
+		cl->parent->children--;
 
 	if (cl->prio_activity)
 		htb_deactivate(q, cl);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pkt_sched: Fix oops in htb_delete.
  2008-08-13 20:13 [PATCH] pkt_sched: Fix oops in htb_delete Jarek Poplawski
@ 2008-08-13 22:16 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-08-13 22:16 UTC (permalink / raw)
  To: jarkao2; +Cc: kaber, netdev

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Wed, 13 Aug 2008 22:13:00 +0200

> pkt_sched: Fix oops in htb_delete.
> 
> Recent changes introduced a bug in htb_delete(): cl->parent->children
> counter update misses checking cl->parent for NULL, which is used for
> root classes, so deleting them causes an oops.
> 
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

Applied, thanks Jarek.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-13 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-13 20:13 [PATCH] pkt_sched: Fix oops in htb_delete Jarek Poplawski
2008-08-13 22:16 ` 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).