• Maneesh Soni's avatar
    [PATCH] kobject/sysfs race fix · 427ac533
    Maneesh Soni authored
    The following patch fixes the race involved between unregistering a kobject
    and simultaneously opeing a corresponding attribute file in sysfs.
    
    Ideally sysfs should take a ref.  to the kobject as long as it has dentries
    referring to the kobjects, but because of current limitations in
    module/kobject ref counting, sysfs's pinning of kobject leads to
    hang/delays in rmmod of certain modules.  The patch checks for unhashed
    dentries in check_perm() while opening a sysfs file.  If the dentry is
    still hashed then it goes ahead and takes the ref to kobject.  This done
    under the per dentry lock.  It does this in the inline routine
    sysfs_get_kobject(dentry).
    427ac533
bin.c 4.19 KB