Driver model: releasing parents before children

From: Alan Stern
Date: Thu Dec 18 2003 - 12:03:12 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/