Commit c8b1f340 authored by Potnuri Bharat Teja's avatar Potnuri Bharat Teja Committed by Jason Gunthorpe

RDMA/iw_cxgb4: Fix incorrect function parameters

While reading the TCB field in t4_tcb_get_field32() the wrong mask is
passed as a parameter which leads the driver eventually to a kernel
panic/app segfault from access to an illegal SRQ index while flushing the
SRQ completions during connection teardown.

Fixes: 11a27e21 ("iw_cxgb4: complete the cached SRQ buffers")
Link: https://lore.kernel.org/r/20200511185608.5202-1-bharat@chelsio.comSigned-off-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 50bbe3d3
...@@ -2891,8 +2891,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2891,8 +2891,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb)
srqidx = ABORT_RSS_SRQIDX_G( srqidx = ABORT_RSS_SRQIDX_G(
be32_to_cpu(req->srqidx_status)); be32_to_cpu(req->srqidx_status));
if (srqidx) { if (srqidx) {
complete_cached_srq_buffers(ep, complete_cached_srq_buffers(ep, srqidx);
req->srqidx_status);
} else { } else {
/* Hold ep ref until finish_peer_abort() */ /* Hold ep ref until finish_peer_abort() */
c4iw_get_ep(&ep->com); c4iw_get_ep(&ep->com);
...@@ -3878,8 +3877,8 @@ static int read_tcb_rpl(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -3878,8 +3877,8 @@ static int read_tcb_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
return 0; return 0;
} }
ep->srqe_idx = t4_tcb_get_field32(tcb, TCB_RQ_START_W, TCB_RQ_START_W, ep->srqe_idx = t4_tcb_get_field32(tcb, TCB_RQ_START_W, TCB_RQ_START_M,
TCB_RQ_START_S); TCB_RQ_START_S);
cleanup: cleanup:
pr_debug("ep %p tid %u %016x\n", ep, ep->hwtid, ep->srqe_idx); pr_debug("ep %p tid %u %016x\n", ep, ep->hwtid, ep->srqe_idx);
......
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