Driver model: releasing parents before children

From: Alan Stern (stern_at_rowland.harvard.edu)
Date: 12/18/03

  • Next message: Greg KH: "Re: module use count & unloading"
    Date:	Thu, 18 Dec 2003 12:02:03 -0500 (EST)
    To: Greg KH <greg@kroah.com>
    
    

    Greg:

    You recently modified kobject.c to fix a bug wherein a kobject's parent
    could get freed before the kobject itself, because kobject_put() on the
    parent was done in the wrong place, during kobject_del() rather than
    kobject_cleanup().

    I just noticed two things about this. First, you neglected to remove the
    comment from kobject.c:unlink() about decrementing the parent's refcount.

    Second, the same bug appears to need fixing in the driver model core. A
    device's parent's refcount is decremented in device_del(), not in
    device_release(). There may be other instances as well; I haven't looked.

    Alan Stern

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Greg KH: "Re: module use count & unloading"

    Relevant Pages