aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2006-05-18 01:20:50 -0400
committerRoland Dreier <rolandd@cisco.com>2006-05-18 01:20:50 -0400
commit0cb4fe8d2658dc0bd1accfbb74ee288a9d6788f4 (patch)
tree26d1c7122d28acecb99698aef362d667b684bfb6 /drivers/infiniband/core
parent093beac189e4295d968f0d38787b46f76cb0eaaa (diff)
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>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/uverbs_mem.c4
1 files changed, 3 insertions, 1 deletions
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)
211 */ 211 */
212 212
213 work = kmalloc(sizeof *work, GFP_KERNEL); 213 work = kmalloc(sizeof *work, GFP_KERNEL);
214 if (!work) 214 if (!work) {
215 mmput(mm);
215 return; 216 return;
217 }
216 218
217 INIT_WORK(&work->work, ib_umem_account, work); 219 INIT_WORK(&work->work, ib_umem_account, work);
218 work->mm = mm; 220 work->mm = mm;