summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/user_mad.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2017-11-14 15:52:13 +0300
committerJason Gunthorpe <jgg@mellanox.com>2017-12-19 01:37:10 +0300
commit0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f (patch)
tree9e6005a7f721c5ed7fc091aa1a6574d5a4610aa1 /drivers/infiniband/core/user_mad.c
parentdbb12562f7c2377c210ed6b2e79eda5bfe23c30c (diff)
downloadlinux-0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f.tar.xz
IB/{cm, umad}: Handle av init error
cm_init_av_for_response depends on ib_init_ah_from_wc() whose return status is ignored. ib_init_ah_from_wc() can fail and its return status should be handled as done in this patch. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/user_mad.c')
-rw-r--r--drivers/infiniband/core/user_mad.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 4b64dd02e090..3179fed4b408 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -246,10 +246,14 @@ static void recv_handler(struct ib_mad_agent *agent,
if (packet->mad.hdr.grh_present) {
struct rdma_ah_attr ah_attr;
const struct ib_global_route *grh;
+ int ret;
- ib_init_ah_from_wc(agent->device, agent->port_num,
- mad_recv_wc->wc, mad_recv_wc->recv_buf.grh,
- &ah_attr);
+ ret = ib_init_ah_from_wc(agent->device, agent->port_num,
+ mad_recv_wc->wc,
+ mad_recv_wc->recv_buf.grh,
+ &ah_attr);
+ if (ret)
+ goto err2;
grh = rdma_ah_read_grh(&ah_attr);
packet->mad.hdr.gid_index = grh->sgid_index;