Commit db2b084c authored by Moshe Lazer's avatar Moshe Lazer Committed by Greg Kroah-Hartman

IB/core: Fix deadlock on uverbs modify_qp error flow

commit 0fb8bcf0 upstream.

The deadlock occurs in __uverbs_modify_qp: we take a lock (idr_read_qp)
and in case of failure in ib_resolve_eth_l2_attrs we don't release
it (put_qp_read).  Fix that.

Fixes: ed4c54e5 ("IB/core: Resolve Ethernet L2 addresses when modifying QP")
Signed-off-by: default avatarMoshe Lazer <moshel@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d524fcea
...@@ -2091,20 +2091,21 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, ...@@ -2091,20 +2091,21 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
if (qp->real_qp == qp) { if (qp->real_qp == qp) {
ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask); ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask);
if (ret) if (ret)
goto out; goto release_qp;
ret = qp->device->modify_qp(qp, attr, ret = qp->device->modify_qp(qp, attr,
modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata); modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata);
} else { } else {
ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask)); ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask));
} }
put_qp_read(qp);
if (ret) if (ret)
goto out; goto release_qp;
ret = in_len; ret = in_len;
release_qp:
put_qp_read(qp);
out: out:
kfree(attr); kfree(attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment