Quoting r. Hal Rosenstock <[EMAIL PROTECTED]>: > Subject: [PATCH] SDP: In sdp_link.c::do_link_path_lookup, handle interface > table numbering holes > > SDP: In sdp_link.c::do_link_path_lookup, handle interface table > numbering holes > (similar to James Lentini's patch to at.c) > > (this is untested) > > Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]> > > Index: sdp_link.c > =================================================================== > --- sdp_link.c (revision 3623) > +++ sdp_link.c (working copy) > @@ -354,7 +354,6 @@ static void do_link_path_lookup(struct s > struct ipoib_dev_priv *priv; > struct net_device *dev = NULL; > struct rtable *rt; > - int counter = 0; > int result = 0; > struct flowi fl = { > .oif = info->dif, /* oif */ > @@ -435,7 +434,7 @@ static void do_link_path_lookup(struct s > > if (dev->flags & IFF_LOOPBACK) { > dev_put(dev); > - while ((dev = dev_get_by_index(++counter))) { > + for (dev = dev_base; dev; dev = dev->next) { > if (dev->type == ARPHRD_INFINIBAND && > (dev->flags & IFF_UP)) > break; >
I think this list scan needs some kind of protection. The following is what I checked in. Does this needs to be updated in other places as well? Handle net interface table numbering holes (similar to James Lentini's patch to at.c) Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]> Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]> Index: linux-kernel/drivers/infiniband/ulp/sdp/sdp_link.c =================================================================== --- linux-kernel.orig/drivers/infiniband/ulp/sdp/sdp_link.c 2005-10-11 13:48:30.000000000 +0200 +++ linux-kernel/drivers/infiniband/ulp/sdp/sdp_link.c 2005-10-11 13:55:15.000000000 +0200 @@ -433,13 +433,15 @@ static void do_link_path_lookup(struct s if (dev->flags & IFF_LOOPBACK) { dev_put(dev); - while ((dev = dev_get_by_index(++counter))) { + read_lock(&dev_base_lock); + for (dev = dev_base; dev; dev = dev->next) { if (dev->type == ARPHRD_INFINIBAND && - (dev->flags & IFF_UP)) + (dev->flags & IFF_UP)) { + dev_hold(dev); break; - else - dev_put(dev); + } } + read_unlock(&dev_base_lock); } if (!dev) { -- MST _______________________________________________ openib-general mailing list openib-general@openib.org http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general