Skip to content

Commit 12eb513

Browse files
Steve Wisedledford
authored andcommitted
iw_cxgb4: stop MPA_REPLY timer when disconnecting
There exists a race where the application can setup a connection and then disconnect it before iw_cxgb4 processes the fw4_ack message. For passive side connections, the fw4_ack message is used to know when to stop the ep timer for MPA_REPLY messages. If the application disconnects before the fw4_ack is handled then c4iw_ep_disconnect() needs to clean up the timer state and stop the timer before restarting it for the disconnect timer. Failure to do this results in a "timer already started" message and a premature stopping of the disconnect timer. Fixes: e4b76a2 ("RDMA/iw_cxgb4: stop_ep_timer() after MPA negotiation") Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent cea05ea commit 12eb513

File tree

1 file changed

+11
-1
lines changed
  • drivers/infiniband/hw/cxgb4

1 file changed

+11
-1
lines changed

drivers/infiniband/hw/cxgb4/cm.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3068,9 +3068,9 @@ static int fw4_ack(struct c4iw_dev *dev, struct sk_buff *skb)
30683068
PDBG("%s last streaming msg ack ep %p tid %u state %u "
30693069
"initiator %u freeing skb\n", __func__, ep, ep->hwtid,
30703070
state_read(&ep->com), ep->mpa_attr.initiator ? 1 : 0);
3071+
mutex_lock(&ep->com.mutex);
30713072
kfree_skb(ep->mpa_skb);
30723073
ep->mpa_skb = NULL;
3073-
mutex_lock(&ep->com.mutex);
30743074
if (test_bit(STOP_MPA_TIMER, &ep->com.flags))
30753075
stop_ep_timer(ep);
30763076
mutex_unlock(&ep->com.mutex);
@@ -3647,6 +3647,16 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
36473647
ep->com.state = ABORTING;
36483648
else {
36493649
ep->com.state = CLOSING;
3650+
3651+
/*
3652+
* if we close before we see the fw4_ack() then we fix
3653+
* up the timer state since we're reusing it.
3654+
*/
3655+
if (ep->mpa_skb &&
3656+
test_bit(STOP_MPA_TIMER, &ep->com.flags)) {
3657+
clear_bit(STOP_MPA_TIMER, &ep->com.flags);
3658+
stop_ep_timer(ep);
3659+
}
36503660
start_ep_timer(ep);
36513661
}
36523662
set_bit(CLOSE_SENT, &ep->com.flags);

0 commit comments

Comments
 (0)