# Re: \[PATCH\] iw\_cm: reject connect requests if cmid is not in LISTEN

- From: Steve Wise \<hidden\>
- Date: 2012-02-23 15:24:54 
- List: linux-rdma
- Page: https://ratatoskr.run/linux-rdma/2012/02/15417397
- Thread: https://ratatoskr.run/linux-rdma/2012/02/15417397/t.md

```text
On 02/23/2012 01:46 AM, Roland Dreier wrote:
> On Wed, Feb 22, 2012 at 1:43 PM, Steve Wise[ref]  wrote:
>> diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
>> index 1a696f7..6847d76 100644
>> --- a/drivers/infiniband/core/iwcm.c
>> +++ b/drivers/infiniband/core/iwcm.c
>> @@ -631,6 +631,8 @@ static void cm_conn_req_handler(struct iwcm_id_private *listen_id_priv,
>>         spin_lock_irqsave(&listen_id_priv->lock, flags);
>>         if (listen_id_priv->state != IW_CM_STATE_LISTEN) {
>>                 spin_unlock_irqrestore(&listen_id_priv->lock, flags);
>> +               iw_cm_reject(cm_id, NULL, 0);
>> +               iw_destroy_cm_id(cm_id);
>>                 goto out;
>>         }
>>         spin_unlock_irqrestore(&listen_id_priv->lock, flags);
> Thanks, this makes more sense to my brain at least.
>

Yes, this is the best fix methinks.  Thanks for the review!

> I assume this works just as well in your testing? :)

Yes, I've run some large NP MPI tests that tickle this condition and all the connections get cleaned up now.  I also ran some other MPI regression tests with this fix.


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
```
