Merge branch 'intx' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6
[pandora-kernel.git] / drivers / infiniband / core / uverbs_mem.c
index ed550f6..db12cc0 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -178,9 +179,10 @@ void ib_umem_release(struct ib_device *dev, struct ib_umem *umem)
        up_write(&current->mm->mmap_sem);
 }
 
-static void ib_umem_account(void *work_ptr)
+static void ib_umem_account(struct work_struct *_work)
 {
-       struct ib_umem_account_work *work = work_ptr;
+       struct ib_umem_account_work *work =
+               container_of(_work, struct ib_umem_account_work, work);
 
        down_write(&work->mm->mmap_sem);
        work->mm->locked_vm -= work->diff;
@@ -210,10 +212,12 @@ 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);
+       INIT_WORK(&work->work, ib_umem_account);
        work->mm   = mm;
        work->diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT;