Commit f90ead8d authored by Moshe Lazer's avatar Moshe Lazer Committed by Sasha Levin

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 avatarSasha Levin <sasha.levin@oracle.com>
parent b092f84a
......@@ -2057,20 +2057,21 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
if (qp->real_qp == qp) {
ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask);
if (ret)
goto out;
goto release_qp;
ret = qp->device->modify_qp(qp, attr,
modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata);
} else {
ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask));
}
put_qp_read(qp);
if (ret)
goto out;
goto release_qp;
ret = in_len;
release_qp:
put_qp_read(qp);
out:
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