public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Nathan Lynch <ntl@pobox.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: sysfs-related oops during module unload (2.6.16-rc2)
Date: Sat, 11 Feb 2006 14:45:26 -0800	[thread overview]
Message-ID: <20060211224526.GA25237@kroah.com> (raw)
In-Reply-To: <20060211220351.GA3293@localhost.localdomain>

On Sat, Feb 11, 2006 at 04:03:53PM -0600, Nathan Lynch wrote:
> If the refcnt attribute of a module is open when the module is
> unloaded, we get an oops when the file is closed.  I used ide_cd for
> this report but I don't think the oops is caused by the driver itself.
> This bug seems to be restricted to the /sys/module hierarchy; it
> doesn't happen with /sys/class etc.
> 
> I suspect it's an extra put or a missing get somewhere, but the fix
> isn't obvious to me after looking at it for a little while, so I'm
> punting.
> 
> I'm pretty sure this happens with 2.6.15; I can double-check if
> needed.

Ugh, we aren't setting the owner of these fields properly, good catch.

Does the patch below (built tested only), solve this for you?

thanks,

greg k-h

-----------------

 kernel/module.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- gregkh-2.6.orig/kernel/module.c	2006-01-17 08:27:49.000000000 -0800
+++ gregkh-2.6/kernel/module.c	2006-02-11 14:44:19.000000000 -0800
@@ -1085,8 +1085,10 @@
 
 	for (i = 0; (attr = modinfo_attrs[i]) && !error; i++) {
 		if (!attr->test ||
-		    (attr->test && attr->test(mod)))
+		    (attr->test && attr->test(mod))) {
+			attr->attr.owner = mod;
 			error = sysfs_create_file(&mod->mkobj.kobj,&attr->attr);
+		}
 	}
 	return error;
 }

  reply	other threads:[~2006-02-11 22:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-11 22:03 sysfs-related oops during module unload (2.6.16-rc2) Nathan Lynch
2006-02-11 22:45 ` Greg KH [this message]
2006-02-12  5:27   ` Nathan Lynch
2006-02-12  5:38     ` Greg KH
2006-02-16 21:50       ` Greg KH
     [not found]         ` <200602162253.45621.dtor_core@ameritech.net>
2006-02-18  0:36           ` Greg KH
2006-02-19  0:47         ` Nathan Lynch
2006-02-19  0:57           ` Greg KH
2006-02-21  5:50             ` Nathan Lynch
2006-02-21  6:12               ` 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=20060211224526.GA25237@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntl@pobox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox