lkml.org 
[lkml]   [2004]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] More Driver Core patches for 2.6.10-rc1
Date
From
ChangeSet 1.2449.2.6, 2004/11/04 10:54:31-08:00, tj@home-tj.org

[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: Tejun Heo <tj@home-tj.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


fs/sysfs/file.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)


diff -Nru a/fs/sysfs/file.c b/fs/sysfs/file.c
--- a/fs/sysfs/file.c 2004-11-04 16:30:39 -08:00
+++ b/fs/sysfs/file.c 2004-11-04 16:30:39 -08:00
@@ -330,11 +330,13 @@
{
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/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.071 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site