Re: BUG: atomic counter underflow when running "rmmod tg3" on2.6.10-rc1-mm3

From: David S. Miller
Date: Tue Nov 09 2004 - 02:02:20 EST


On Tue, 9 Nov 2004 03:33:36 +0100
Bernhard Rosenkraenzer <bero@xxxxxxxxxxxx> wrote:

> BUG: atomic counter underflow at:
> [<c02882f6>] qdisc_destroy+0x66/0x80

Yes, this was fixed recently. The fix should be in Linus's
tree as of this morning.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/11/05 16:30:34-08:00 tgraf@xxxxxxx
# [PKT_SCHED]: Builtin qdiscs should avoid all qdisc_destroy() processing.
#
# None of the code in __qdisc_destroy should be applied to a builtin qdisc
# or am I missing something?
#
# The patch below prevents builtin qdiscs from being destroyed and
# fixes a refcnt underflow whould lead to a bogus list unlinking
# and dev_put.
#
# Signed-off-by: Thomas Graf <tgraf@xxxxxxx>
# Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
#
# net/sched/sch_generic.c
# 2004/11/05 16:30:14-08:00 tgraf@xxxxxxx +3 -3
# [PKT_SCHED]: Builtin qdiscs should avoid all qdisc_destroy() processing.
#
# None of the code in __qdisc_destroy should be applied to a builtin qdisc
# or am I missing something?
#
# The patch below prevents builtin qdiscs from being destroyed and
# fixes a refcnt underflow whould lead to a bogus list unlinking
# and dev_put.
#
# Signed-off-by: Thomas Graf <tgraf@xxxxxxx>
# Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
#
diff -Nru a/net/sched/sch_generic.c b/net/sched/sch_generic.c
--- a/net/sched/sch_generic.c 2004-11-08 21:06:35 -08:00
+++ b/net/sched/sch_generic.c 2004-11-08 21:06:35 -08:00
@@ -479,15 +479,15 @@
module_put(ops->owner);

dev_put(qdisc->dev);
- if (!(qdisc->flags&TCQ_F_BUILTIN))
- kfree((char *) qdisc - qdisc->padded);
+ kfree((char *) qdisc - qdisc->padded);
}

/* Under dev->queue_lock and BH! */

void qdisc_destroy(struct Qdisc *qdisc)
{
- if (!atomic_dec_and_test(&qdisc->refcnt))
+ if (qdisc->flags & TCQ_F_BUILTIN ||
+ !atomic_dec_and_test(&qdisc->refcnt))
return;
list_del(&qdisc->list);
call_rcu(&qdisc->q_rcu, __qdisc_destroy);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/