IB/uverbs: Release lock on error path
authorGanapathi CH <cganapathi@novell.com>
Sun, 18 Jun 2006 03:37:40 +0000 (20:37 -0700)
committerRoland Dreier <rolandd@cisco.com>
Sun, 18 Jun 2006 03:37:40 +0000 (20:37 -0700)
If ibdev->alloc_ucontext() fails then ib_uverbs_get_context() does not
unlock file->mutex before returning error.

Signed-off by: Ganapathi CH <cganapathi@novell.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/uverbs_cmd.c

index 9f69bd48eb1bee6ccf488f0e71a7777efd7f5f0d..4266d2e5eba423f20112d04e3a39f6262211809a 100644 (file)
@@ -80,8 +80,10 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,
                   in_len - sizeof cmd, out_len - sizeof resp);
 
        ucontext = ibdev->alloc_ucontext(ibdev, &udata);
-       if (IS_ERR(ucontext))
-               return PTR_ERR(file->ucontext);
+       if (IS_ERR(ucontext)) {
+               ret = PTR_ERR(file->ucontext);
+               goto err;
+       }
 
        ucontext->device = ibdev;
        INIT_LIST_HEAD(&ucontext->pd_list);