[PATCH] Fix scsi host attributes
The shost_attrs stuff looks fine, expect for two points. 1. The scsi_sysfs_modify_shost_attribute() and scsi_sysfs_modify_sdev_attribute() functions appear to be written a bit carelessly. Below is a patch that: permits modification of the first attribute in the list, allocates a new list with entries having the correct size, copies the correct number of entries from the old list, and wraps excessively long source lines. 2. More importantly, the current organization of the code has a serious problem. The SCSI core does not modify the host driver when the reference count for either shost->class_dev or shost->host_gendev drops to 0. Without knowing that, it is unsafe for the driver ever to deallocate a private host data structure, since a user process may continue to hold a reference to an open attribute file indefinitely, even after scsi_unregister() has returned.
Showing
Please register or sign in to comment