提交 ec924b47 编写于 作者: M Michael S. Tsirkin 提交者: Roland Dreier

IB/uverbs: Fix unlocking in error paths

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: NMichael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 abb5a5cc
...@@ -1775,7 +1775,7 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file, ...@@ -1775,7 +1775,7 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
ah = ib_create_ah(pd, &attr); ah = ib_create_ah(pd, &attr);
if (IS_ERR(ah)) { if (IS_ERR(ah)) {
ret = PTR_ERR(ah); ret = PTR_ERR(ah);
goto err; goto err_put;
} }
ah->uobject = uobj; ah->uobject = uobj;
...@@ -1811,6 +1811,9 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file, ...@@ -1811,6 +1811,9 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
err_destroy: err_destroy:
ib_destroy_ah(ah); ib_destroy_ah(ah);
err_put:
put_pd_read(pd);
err: err:
put_uobj_write(uobj); put_uobj_write(uobj);
return ret; return ret;
...@@ -1984,7 +1987,7 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, ...@@ -1984,7 +1987,7 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file,
srq = pd->device->create_srq(pd, &attr, &udata); srq = pd->device->create_srq(pd, &attr, &udata);
if (IS_ERR(srq)) { if (IS_ERR(srq)) {
ret = PTR_ERR(srq); ret = PTR_ERR(srq);
goto err; goto err_put;
} }
srq->device = pd->device; srq->device = pd->device;
...@@ -2029,6 +2032,9 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, ...@@ -2029,6 +2032,9 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file,
err_destroy: err_destroy:
ib_destroy_srq(srq); ib_destroy_srq(srq);
err_put:
put_pd_read(pd);
err: err:
put_uobj_write(&obj->uobject); put_uobj_write(&obj->uobject);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册