On 14/01/12 03:31, Eric W. Biederman wrote: > At a practical level I goofed and overlooked a case where dir can be > NULL in the remove case. Certainly sysfs_hash_and_remove which is the > guts of sysfs_remove has had a check for dir being NULL for a long time, > and it appears to have been introduced by commit > 641e6f30a095f3752ed84fd9d279382f5d3ef4c1. > > From long term maintenance perspective we need to stop allowing this > case. sysfs_remove_dir really needs to have it's files and directories > removed before we remove the directory itself. It is totally insane > to ask people to remove attribute that are already gone. > > We have a groups member in struct device that can be used to hold > groups of attributes that the device layer will add and remove > when the a device is added and removed. Perhaps we should use > that. > > Looking a little farther we do have a driver ->remove call that > is called before the usb_serial device is removed. > > Interesting the sysfs_attributes are created in .port_probe > but are removed in .disconnect instead of in .port_remove. > > So the fix for this specific case is to make edge_remove_sysfs_attrs the > the .port_remove method. > > It isn't nice to have a NULL pointer deference for a case that we used > to allow (however ill advised). I will cook up a patch that handles > this case in device_remove_file but prints a very nasty warning with a > stack back trace when it does. > > Given that device remove methods are called before a device is deleted > I don't see any excuse to continue to support the nonsense of a deleting > an attribute after the device has been deleted. > > My proposed io_ti.c fix (untested). Your patch is working perfectly. Thank you very much for your rapid response and the very informative explanation. > > Eric > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html