netdev
[Top] [All Lists]

Re: [PATCH] PKT_SCHED: Fix double locking in tcindex destroy path

To: Thomas Graf <tgraf@xxxxxxx>
Subject: Re: [PATCH] PKT_SCHED: Fix double locking in tcindex destroy path
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Fri, 10 Dec 2004 03:35:45 +0100
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <20041210014918.GT1371@xxxxxxxxxxxxxx>
References: <20041210014918.GT1371@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20041008 Debian/1.7.3-5
Thomas Graf wrote:

tcindex's destroy uses its own delete functions to destroy its
configuration. The delete function (correctly) takes the qdisc_tree_lock
to prevent list walkings from happening while removing from the list.
The qdisc_tree_lock is already held if we're comming via the destroy
path and thus a double locking takes place.

Patch not needed for 2.4 since both destroy paths are unlocked but will
be needed if we add them.
Looks correct, but 2.4 does need this. qdisc_destroy in 2.4 always
happens under dev->queue_lock. For example dev_shutdown from 2.4:

       write_lock(&qdisc_tree_lock);
       spin_lock_bh(&dev->queue_lock);
...
       qdisc_destroy(qdisc);

But please rename "already_locked" to "lock" to make it look less like
a hack to avoid deadlock.

+       return __tcindex_delete(tp,arg, 1);
And a space is missing :)

Regards
Patrick


<Prev in Thread] Current Thread [Next in Thread>