Skip to content

Commit

Permalink
IB/uverbs: Don't leak ref to mm on error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roland Dreier committed May 18, 2006
1 parent 093beac commit 0cb4fe8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/infiniband/core/uverbs_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0cb4fe8

Please sign in to comment.