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

Michael S. Tsirkin mst at mellanox.co.il
Tue Aug 16 10:12:01 PDT 2005


Quoting r. Tom Duffy <thomas.duffy.99 at alumni.brown.edu>:
> Subject: Re: [PATCH] SDP: fix oops with port reuse
> 
> 
> On Aug 16, 2005, at 8:30 AM, Michael S. Tsirkin wrote:
> >Why not? You cant really bind to port 0, can you?
> 
> I don't think so.  It was Libor who objected to this, so he must have  
> had a reason.

Its a mystery then. IMO, even if we agree on using list_del_init
(as discussed below) we should add a BUG_ON(!conn->src_port) as
a sanity check.

> >
> >>    Maybe its a good idea to init bind_next at socket creation, at port_put
> >>    we could call list_del_init, and/or use list_empty to figure out
> >>    whether the socket is on the bind list.
> >>
> >>
> >> Do you mean we would setup the bind_next field to point to itself?
> >>
> >
> >Yes.
> 
> Other option is to initialize and check for LIST_POISON[12].

Ugh.

> >
> >>This is normally reserved for list heads.
> >>
> >
> >What's list_del_init for then?
> 
> Resetting a list?

Doesnt INIT_LIST_HEAD do this?

list_del_init seems to be an exact match for our case: its
a function that is safe to call twice on the same entry,
and it lets you check that entry is on some list by !list_empty.

Example: kernel/posix-timers.c

-- 
MST



More information about the general mailing list