All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] More Driver Core patches for 2.6.10-rc1
Date: Thu, 4 Nov 2004 16:48:25 -0800	[thread overview]
Message-ID: <10996157052267@kroah.com> (raw)
In-Reply-To: <1099615705183@kroah.com>

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)


  reply	other threads:[~2004-11-05  0:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-05  0:35 [BK PATCH] More USB patches for 2.6.10-rc1 Greg KH
2004-11-05  0:48 ` [PATCH] More Driver Core " Greg KH
2004-11-05  0:48   ` Greg KH
2004-11-05  0:48     ` Greg KH
2004-11-05  0:48       ` Greg KH
2004-11-05  0:48         ` Greg KH
2004-11-05  0:48           ` Greg KH [this message]
2004-11-05  0:48             ` Greg KH
2004-11-05  0:48               ` Greg KH
2004-11-05  0:48                 ` Greg KH
2004-11-05  0:48                   ` Greg KH
2004-11-05  0:48                     ` Greg KH
2004-11-05  0:48                       ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2004-11-12 22:58 [BK PATCH] " Greg KH
2004-11-12 23:00 ` [PATCH] " Greg KH
2004-11-12 23:00   ` Greg KH
2004-11-12 23:00     ` Greg KH
2004-11-12 23:00       ` Greg KH
2004-11-12 23:00         ` Greg KH
2004-11-12 23:00           ` Greg KH
2004-11-12 23:00             ` Greg KH
2004-11-12 23:00               ` Greg KH
2004-11-12 23:00                 ` Greg KH
     [not found]     ` <20041113000052.GC346@electric-eye.fr.zoreil.com>
     [not found]       ` <200411130020.17494.lists@kenneth.aafloy.net>
2004-11-13  0:44         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10996157052267@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.