Subject: [PATCH 2.4]: Don't try to destroy builtin qdiscs

From: Patrick McHardy <[email-masked]>
Date: Fri, 05 Nov 2004 20:46:31 +0100

Backported from Thomas's patch, we also need this for 2.4.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/05 20:44:30+01:00 [email-masked] 
#   [PKT_SCHED]: Don't try to destroy builtin qdiscs
#   
#   Backported from Thomas Graf's fix for 2.6.
#   
#   Signed-off-by: Patrick McHardy <[email-masked]>
# 
# net/sched/sch_generic.c
#   2004/11/05 20:44:28+01:00 [email-masked] +3 -3
#   [PKT_SCHED]: Don't try to destroy builtin qdiscs
#   
#   Backported from Thomas Graf's fix for 2.6.
#   
#   Signed-off-by: Patrick McHardy <[email-masked]>
# 
diff -Nru a/net/sched/sch_generic.c b/net/sched/sch_generic.c
--- a/net/sched/sch_generic.c	2004-11-05 20:44:43 +01:00
+++ b/net/sched/sch_generic.c	2004-11-05 20:44:43 +01:00
@@ -423,7 +423,8 @@
 {
 	struct Qdisc_ops *ops = qdisc->ops;
 
-	if (!atomic_dec_and_test(&qdisc->refcnt))
+	if (qdisc->flags&TCQ_F_BUILTIN ||
+	    !atomic_dec_and_test(&qdisc->refcnt))
 		return;
 	list_del(&qdisc->list);
 #ifdef CONFIG_NET_ESTIMATOR
@@ -433,8 +434,7 @@
 		ops->reset(qdisc);
 	if (ops->destroy)
 		ops->destroy(qdisc);
-	if (!(qdisc->flags&TCQ_F_BUILTIN))
-		kfree(qdisc);
+	kfree(qdisc);
 }