On Fri, 2004-04-02 at 11:45, Mike Anderson wrote: > Maybe some clarification here as I am unsure if we both think there > needs to be a notification (a put call) from outside SCSI. We have > release functions available on most objects in SCSI now. The issue is > that when we register (add_disk, dev_set_drvdata, etc.) or pass a handle > to another subsystem we need a reference count agreement to know when > the other subsystem is done with the the object. Something like the > put_device(parent) used in scsi_host_dev_release.
Actually, no, that's not the issue here, if I understand you. The reference counting model on the sdev->sdev_gendev seems to be working correctly because sr.c takes a reference to the sdev_gendev on open and drops it on close. The problem is that ULDs are implemented as struct device_drivers and as such, their ->remove method gets called *not* on last put of sdev_gendev but on device_del (when there are still active references). sr.c frees the cdinfo structure on ->remove, but still has its own reference to sdev_gendev (because the device is still open). On final close, the generic cdrom code tries to use cdinfo to close the device and references a kfree'd structure. Really what sr.c wants to be doing is freeing the cdinfo structure on last put, not on device_del. James ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel