Commit 3352976c authored by Raju Rangoju's avatar Raju Rangoju Committed by Jason Gunthorpe

RDMA/iw_cxgb4: Fix the unchecked ep dereference

The patch 944661dd: "RDMA/iw_cxgb4: atomically lookup ep and get a
reference" from May 6, 2016, leads to the following Smatch complaint:

    drivers/infiniband/hw/cxgb4/cm.c:2953 terminate()
    error: we previously assumed 'ep' could be null (see line 2945)

Fixes: 944661dd ("RDMA/iw_cxgb4: atomically lookup ep and get a reference")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarRaju Rangoju <rajur@chelsio.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 5fc01fb8
...@@ -2942,15 +2942,18 @@ static int terminate(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2942,15 +2942,18 @@ static int terminate(struct c4iw_dev *dev, struct sk_buff *skb)
ep = get_ep_from_tid(dev, tid); ep = get_ep_from_tid(dev, tid);
if (ep && ep->com.qp) { if (ep) {
pr_warn("TERM received tid %u qpid %u\n", if (ep->com.qp) {
tid, ep->com.qp->wq.sq.qid); pr_warn("TERM received tid %u qpid %u\n", tid,
attrs.next_state = C4IW_QP_STATE_TERMINATE; ep->com.qp->wq.sq.qid);
c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, attrs.next_state = C4IW_QP_STATE_TERMINATE;
C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp,
C4IW_QP_ATTR_NEXT_STATE, &attrs, 1);
}
c4iw_put_ep(&ep->com);
} else } else
pr_warn("TERM received tid %u no ep/qp\n", tid); pr_warn("TERM received tid %u no ep/qp\n", tid);
c4iw_put_ep(&ep->com);
return 0; return 0;
} }
......
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