diff options
author | Moshe Lazer <moshel@mellanox.com> | 2015-02-05 06:53:52 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2015-02-18 01:06:42 -0500 |
commit | 0fb8bcf022f19a375d7c4bd79ac513da8ae6d78b (patch) | |
tree | 93ae49f2d4030a880055fd2392119fec22068dfb | |
parent | c2be9dc0e0fa59cc43c2c7084fc42b430809a0fe (diff) |
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: ed4c54e5b4ba ("IB/core: Resolve Ethernet L2 addresses when modifying QP")
Signed-off-by: Moshe Lazer <moshel@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index b7943ff16ed3..6c52e72f8d2c 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -2091,20 +2091,21 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, | |||
2091 | if (qp->real_qp == qp) { | 2091 | if (qp->real_qp == qp) { |
2092 | ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask); | 2092 | ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask); |
2093 | if (ret) | 2093 | if (ret) |
2094 | goto out; | 2094 | goto release_qp; |
2095 | ret = qp->device->modify_qp(qp, attr, | 2095 | ret = qp->device->modify_qp(qp, attr, |
2096 | modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata); | 2096 | modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata); |
2097 | } else { | 2097 | } else { |
2098 | ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask)); | 2098 | ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask)); |
2099 | } | 2099 | } |
2100 | 2100 | ||
2101 | put_qp_read(qp); | ||
2102 | |||
2103 | if (ret) | 2101 | if (ret) |
2104 | goto out; | 2102 | goto release_qp; |
2105 | 2103 | ||
2106 | ret = in_len; | 2104 | ret = in_len; |
2107 | 2105 | ||
2106 | release_qp: | ||
2107 | put_qp_read(qp); | ||
2108 | |||
2108 | out: | 2109 | out: |
2109 | kfree(attr); | 2110 | kfree(attr); |
2110 | 2111 | ||