From: Roland Dreier Date: Thu, 18 May 2006 05:20:50 +0000 (-0700) Subject: IB/uverbs: Don't leak ref to mm on error path X-Git-Tag: MMI-PSA29.97-13-9~49740^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0cb4fe8d2658dc0bd1accfbb74ee288a9d6788f4;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 --- diff --git a/drivers/infiniband/core/uverbs_mem.c b/drivers/infiniband/core/uverbs_mem.c index 36a32c315668..efe147dbeb42 100644 --- a/drivers/infiniband/core/uverbs_mem.c +++ b/drivers/infiniband/core/uverbs_mem.c @@ -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;