[Open-FCoE] [PATCH V5 15/16] fcoe: Fix module ref count bug by adding NETDEV UNREGISTER handling

Chris Leech christopher.leech at intel.com
Tue Jul 28 17:56:06 UTC 2009


On Mon, Jul 27, 2009 at 07:12:33AM -0700, Fastabend, John R wrote:
> > @@ -1704,26 +1646,33 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
> >                 rc = -ENODEV;
> >                 goto out_nodev;
> >         }
> > -       /* look for existing lport */
> > -       lport = fcoe_hostlist_lookup(netdev);
> > -       if (!lport) {
> > +
> > +       write_lock(&fcoe_hostlist_lock);
> > +       fcoe = fcoe_hostlist_lookup_port(netdev);
> > +       if (!fcoe) {
> > +               write_unlock(&fcoe_hostlist_lock);
> >                 rc = -ENODEV;
> > -               goto out_putdev;
> > +               goto out_nodev;
> >         }
> > -       /* Remove the instance from fcoe's list */
> > -       fcoe_hostlist_remove(lport);
> > -       port = lport_priv(lport);
> > -       fcoe = port->fcoe;
> > -       fcoe_if_destroy(lport);
> > -       fcoe_ethdrv_put(netdev);
> > -       rc = 0;
> > -out_putdev:
> > +       list_del(&fcoe->list);
> > +       write_unlock(&fcoe_hostlist_lock);
> > +       fcoe_if_destroy(fcoe->ctlr.lp);
> >         dev_put(netdev);
> >  out_nodev:
> >         mutex_unlock(&fcoe_config_mutex);
> >         return rc;
> >  }
> >   
> If fcoe_hostlist_lookup_port() fails then dev_put() needs to be called. 
> Removing out_putdev breaks this and the netdev reference count is wrong. 
> The failure occurs when attempting to delete an fcoe interface that has 
> not been created. After this occurs trying to remove the netdevice will 
> hang.

Thanks for catching this, I'm not sure what happened here.  I'll add the
out_putdev label back right before the dev_put() call, and change the
hostlist lookup fail case back to jumping there.




More information about the devel mailing list