Messages in this thread Patch in this message | | | Date | Thu, 4 Nov 2004 16:03:37 +0900 | From | Tejun Heo <> | Subject | Re: [PATCH 2.6.10-rc1 3/5] driver-model: sysfs_release() dangling pointer reference fix |
| |
df_03_sysfs_release_fix.patch
Some attributes are allocated dynamically (e.g. module and device parameters) and are usually deallocated when the assoicated kobject is released. So, it's not safe to access attr after putting the kobject.
Signed-off-by: Tejun Heo <tj@home-tj.org>
Index: linux-export/fs/sysfs/file.c =================================================================== --- linux-export.orig/fs/sysfs/file.c 2004-11-04 10:25:58.000000000 +0900 +++ linux-export/fs/sysfs/file.c 2004-11-04 11:04:14.000000000 +0900 @@ -330,11 +330,13 @@ static int sysfs_release(struct inode * { struct kobject * kobj = to_kobj(filp->f_dentry->d_parent); struct attribute * attr = to_attr(filp->f_dentry); + struct module * owner = attr->owner; struct sysfs_buffer * buffer = filp->private_data; if (kobj) kobject_put(kobj); - module_put(attr->owner); + /* After this point, attr should not be accessed. */ + module_put(owner); if (buffer) { if (buffer->page) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |