Commit 0cb4fe8d authored by Roland Dreier's avatar Roland Dreier

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: default avatarRoland Dreier <rolandd@cisco.com>
parent 093beac1
...@@ -211,8 +211,10 @@ void ib_umem_release_on_close(struct ib_device *dev, struct ib_umem *umem) ...@@ -211,8 +211,10 @@ void ib_umem_release_on_close(struct ib_device *dev, struct ib_umem *umem)
*/ */
work = kmalloc(sizeof *work, GFP_KERNEL); work = kmalloc(sizeof *work, GFP_KERNEL);
if (!work) if (!work) {
mmput(mm);
return; return;
}
INIT_WORK(&work->work, ib_umem_account, work); INIT_WORK(&work->work, ib_umem_account, work);
work->mm = mm; work->mm = mm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment