IB/uverbs: Don't leak ref to mm on error path

In ib_umem_release_on_close(), if the kmalloc() fails, then a
reference to current->mm will be leaked.  Fix this by adding a mmput()
instead of just returning on kmalloc() failure.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
Roland Dreier 2006-05-17 22:20:50 -07:00
parent 093beac189
commit 0cb4fe8d26
1 changed files with 3 additions and 1 deletions

View File

@ -211,8 +211,10 @@ void ib_umem_release_on_close(struct ib_device *dev, struct ib_umem *umem)
*/
work = kmalloc(sizeof *work, GFP_KERNEL);
if (!work)
if (!work) {
mmput(mm);
return;
}
INIT_WORK(&work->work, ib_umem_account, work);
work->mm = mm;