]> git.baikalelectronics.ru Git - kernel.git/commit
IB/umem: Fix possible hang on process exit
authorRoland Dreier <rolandd@cisco.com>
Thu, 21 Jun 2007 18:05:58 +0000 (11:05 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 21 Jun 2007 18:05:58 +0000 (11:05 -0700)
commit80bb1dbdad6e5793aa82f08dee0fd420095e3217
treed0061299531d0cda6bd83196f8f4c32c5f93af15
parent1c6d49186bb71a53bc19cadf2e628d8be0d45d1c
IB/umem: Fix possible hang on process exit

If ib_umem_release() is called after ib_uverbs_close() sets context->closing,
then a process can get stuck in a D state, because the code boils down to

if (down_write_trylock(&mm->mmap_sem))
down_write(&mm->mmap_sem);

which is obviously a stupid instant deadlock.  Fix the code so that we
only try to take the lock once.

This bug was introduced in commit 93ab473b ("IB/uverbs: Export
ib_umem_get()/ib_umem_release() to modules") which fortunately never
made it into a release, and was reported by Pete Wyckoff <pw@osc.edu>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/umem.c