Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fb8bcf0 authored by Moshe Lazer's avatar Moshe Lazer Committed by Roland Dreier
Browse files

IB/core: Fix deadlock on uverbs modify_qp error flow



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>
parent c2be9dc0
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2091,20 +2091,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);