[openib-general] [PATCH] SDP: fix oops with port reuse

Libor Michalek limichal at cisco.com
Mon Jul 25 12:20:15 PDT 2005


On Mon, Jul 25, 2005 at 11:18:20AM -0700, Tom Duffy wrote:
> This patch fixes an oops that I introduced in my conversion to use linux
> lists for binds (committed in revision 2874).  If two sockets tried to
> use the same port, after failing to get the port (again), it would
> attempt a put and the second attempt would oops the machine.  This patch
> fixes the problem that looked like this:

Tom,

  The original code at the begining of sdp_inet_port_put() was checking
to see if the connection was already in the bind list, and returning an
error if it was not in the list. The error check that's there now is
doing something different, and we return success if the connection
is not in the bind list and has a put() done on it.

  If we are regularly doing a put on a socket not in the bind list,
the function should be made void, and the check for list membership
not generate an error...

-Libor


> 
> Signed-off-by: Tom Duffy <tduffy at sun.com>
> 
> Index: drivers/infiniband/ulp/sdp/sdp_conn.c
> ===================================================================
> --- drivers/infiniband/ulp/sdp/sdp_conn.c	(revision 2904)
> +++ drivers/infiniband/ulp/sdp/sdp_conn.c	(working copy)
> @@ -498,7 +498,8 @@ int sdp_inet_port_put(struct sdp_sock *c
>  		return -EADDRNOTAVAIL;
>  
>  	spin_lock_irqsave(&dev_root_s.bind_lock, flags);
> -	list_del(&conn->bind_next);
> +	if (conn->src_port)
> +		list_del(&conn->bind_next);
>  	conn->src_port = 0;
>  	spin_unlock_irqrestore(&dev_root_s.bind_lock, flags);
>  
> 
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general



More information about the general mailing list