]> err.no Git - linux-2.6/commitdiff
IB/uverbs: Don't leak ref to mm on error path
authorRoland Dreier <rolandd@cisco.com>
Thu, 18 May 2006 05:20:50 +0000 (22:20 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 18 May 2006 05:20:50 +0000 (22:20 -0700)
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>
drivers/infiniband/core/uverbs_mem.c

index 36a32c315668cebbc7e34be30704b0c4851bcf66..efe147dbeb42137e695298e19c525e1acf027a07 100644 (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;