Commit 9522144b authored by Tejun Heo's avatar Tejun Heo Committed by Greg Kroah-Hartman

[PATCH] 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: default avatarTejun Heo <tj@home-tj.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent fa39fa6b
......@@ -330,11 +330,13 @@ static int sysfs_release(struct inode * inode, struct file * filp)
{
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment