[openib-general] [PATCH 2/2] ib_cm: fix REJ due to invalid GID

Arne Redlich arne.redlich at xiranet.com
Wed Jul 19 00:11:28 PDT 2006


Am Dienstag, den 18.07.2006, 10:09 -0700 schrieb Sean Hefty:
> Arne Redlich wrote:
> > @@ -1354,6 +1354,7 @@ static int cm_req_handler(struct cm_work
> >  							    id.local_id);
> >  	if (IS_ERR(cm_id_priv->timewait_info)) {
> >  		ret = PTR_ERR(cm_id_priv->timewait_info);
> > +		reject = 1;
> >  		goto error1;
> >  	}
> 
> An error here indicates that we were unable to allocate memory to record the 
> incoming connection request.  I didn't send a reject in this case to allow it to 
> be retried.  (The chances of being able to send a reject if this allocation 
> fails is unlikely.)
> 
> If there's a need to send a reject in this case, we should call cm_issue_rej(). 
>   I don't think that we can send one from cm_destroy_id() unless the cm_id has 
> been initialized further.

This was merely to initialize "reject" (=> "err = 0" using the old
code), otherwise preserving the original behaviour.

> > @@ -1373,12 +1375,21 @@ static int cm_req_handler(struct cm_work
> >  
> >  	cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]);
> >  	ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
> > -	if (ret)
> > +	if (ret) {
> > +		cm_issue_rej(work->port, work->mad_recv_wc, IB_CM_INVALID_GID,
> > +			     CM_MSG_RESPONSE_REQ, NULL, 0);
> 
> Change to IB_CM_REJ_INVALID_GID.
> 
> > +		reject = 0;
> >  		goto error3;
> > +	}
> >  	if (req_msg->alt_local_lid) {
> >  		ret = cm_init_av_by_path(&work->path[1], &cm_id_priv->alt_av);
> > -		if (ret)
> > +		if (ret) {
> > +			cm_issue_rej(work->port, work->mad_recv_wc,
> > +				     IB_CM_INVALID_ALT_GID, CM_MSG_RESPONSE_REQ,
> > +				     NULL, 0);
> 
> IB_CM_REJ_INVALID_ALT_GID.

Of course. I really don't know where my mind was when submitting this
apparently half baked patch instead of the final version which gets (at
least) this one right and also doesn't have the "if - else - else"
oddity pointed out by Michael. Sorry.

Thanks,
Arne
-- 
Arne Redlich
Xiranet Communications GmbH





More information about the general mailing list