]> git.hungrycats.org Git - linux/commit
LIB: remove unmatched write_lock() in gen_pool_destroy zygo-2.6.30-zb5s zygo-2.6.30.1-zb5s
authorZygo Blaxell <zblaxell@dactyl.hungrycats.org>
Fri, 12 Jun 2009 17:37:50 +0000 (13:37 -0400)
committerZygo Blaxell <zblaxell@dactyl.hungrycats.org>
Fri, 12 Jun 2009 17:52:06 +0000 (13:52 -0400)
commit6bc2aea166eb66a36e7ae3979af85faf80f7d2e3
tree86a231e0178f43c3d13054533cd8d17f6a656c2d
parent13aea3b21c4b4a24ac59a49eeb129938cdcb2d2e
LIB: remove unmatched write_lock() in gen_pool_destroy

There is a call to write_lock() in gen_pool_destroy which is not balanced
by any corresponding write_unlock().  This causes problems with preemption
because the preemption-disable counter is incremented in the write_lock()
call, but never decremented by a write_unlock() call.  This bug is
difficult to observe in the field because only two in-tree drivers call
gen_pool_destroy, and one of them is non-x86 arch-specific code.

To fix this, I have chosen removing the write_lock() over adding a
write_unlock() because the lock in question is inside a structure which
is being freed.  Any other thread that waited to acquire such a lock
while gen_pool_destroy was running would find itself holding a lock
in recently-freed or about-to-be-freed memory.  Using a pool while it is
in the process of being destroyed is a bug that must be resolved outside
of the gen_pool_destroy function.

Signed-off-by: Zygo Blaxell <zygo.blaxell@xandros.com>
lib/genalloc.c