ib_uverbs_create_ah() and ib_uverbs_create_srq() did not release the
PD's read lock in their error paths, which lead to deadlock when
destroying the PD.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
        ah = ib_create_ah(pd, &attr);
        if (IS_ERR(ah)) {
                ret = PTR_ERR(ah);
-               goto err;
+               goto err_put;
        }
 
        ah->uobject  = uobj;
 err_destroy:
        ib_destroy_ah(ah);
 
+err_put:
+       put_pd_read(pd);
+
 err:
        put_uobj_write(uobj);
        return ret;
        srq = pd->device->create_srq(pd, &attr, &udata);
        if (IS_ERR(srq)) {
                ret = PTR_ERR(srq);
-               goto err;
+               goto err_put;
        }
 
        srq->device        = pd->device;
 err_destroy:
        ib_destroy_srq(srq);
 
+err_put:
+       put_pd_read(pd);
+
 err:
        put_uobj_write(&obj->uobject);
        return ret;