public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: vincent.fortier1@ec.gc.ca,
	Dhaval Giani <dhaval@linux.vnet.ibm.com>,
	Greg KH <gregkh@suse.de>, Randy Dunlap <randy.dunlap@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
	Balbir Singh <balbir@in.ibm.com>,
	maneesh@in.ibm.com
Subject: Re: 2.6.22.14 oops msg with commvault galaxy ?
Date: Thu, 13 Dec 2007 17:50:59 +0100	[thread overview]
Message-ID: <20071213165059.GC4865@elte.hu> (raw)
In-Reply-To: <1197562981.19869.5.camel@lov.site>


* Kay Sievers <kay.sievers@vrfy.org> wrote:

> > > > > +   sa->attr.owner = NULL;
> > > > >     sa->attr.name = name;
> > > >
> > > > i'm wondering why doesnt this affect 2.6.23 and later? Does sysfs
> > > > initialize the owner field to NULL automatically?
> > > 
> > > Attibutes do not have an owner anymore:
> > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7b595756ec1f49e0049a9e01a1298d53a7faaa15
> > 
> > This one also fails to apply properly at the exact same place has 
> > Ingo's previously posted patch.  Would need to backport his one.
> 
> It depends on a completely reworked sysfs logic, I don't think it 
> makes any sense to backport that.

well, if it fixes a live bug in a still supported stable kernel 
release...

Vincent, could you try to just get rid of all actual uses of 
se->attr.owner, within fs/sysfs/*.c? Something like the patch below. 
(totally untested - might be fatally broken as well)

	Ingo

---
 fs/sysfs/bin.c  |    7 -------
 fs/sysfs/file.c |   13 -------------
 2 files changed, 20 deletions(-)

Index: linux-cfs-2.6.22.13.q/fs/sysfs/bin.c
===================================================================
--- linux-cfs-2.6.22.13.q.orig/fs/sysfs/bin.c
+++ linux-cfs-2.6.22.13.q/fs/sysfs/bin.c
@@ -125,11 +125,6 @@ static int open(struct inode * inode, st
 	if (!kobj || !attr)
 		goto Done;
 
-	/* Grab the module reference for this attribute if we have one */
-	error = -ENODEV;
-	if (!try_module_get(attr->attr.owner)) 
-		goto Done;
-
 	error = -EACCES;
 	if ((file->f_mode & FMODE_WRITE) && !(attr->write || attr->mmap))
 		goto Error;
@@ -145,7 +140,6 @@ static int open(struct inode * inode, st
     goto Done;
 
  Error:
-	module_put(attr->attr.owner);
  Done:
 	if (error)
 		kobject_put(kobj);
@@ -159,7 +153,6 @@ static int release(struct inode * inode,
 	u8 * buffer = file->private_data;
 
 	kobject_put(kobj);
-	module_put(attr->attr.owner);
 	kfree(buffer);
 	return 0;
 }
Index: linux-cfs-2.6.22.13.q/fs/sysfs/file.c
===================================================================
--- linux-cfs-2.6.22.13.q.orig/fs/sysfs/file.c
+++ linux-cfs-2.6.22.13.q/fs/sysfs/file.c
@@ -257,12 +257,6 @@ static int sysfs_open_file(struct inode 
 	if (!kobj || !attr)
 		goto Einval;
 
-	/* Grab the module reference for this attribute if we have one */
-	if (!try_module_get(attr->owner)) {
-		error = -ENODEV;
-		goto Done;
-	}
-
 	/* if the kobject has no ktype, then we assume that it is a subsystem
 	 * itself, and use ops for it.
 	 */
@@ -332,7 +326,6 @@ static int sysfs_open_file(struct inode 
 	goto Done;
  Eaccess:
 	error = -EACCES;
-	module_put(attr->owner);
  Done:
 	if (error)
 		kobject_put(kobj);
@@ -343,14 +336,12 @@ static int sysfs_release(struct inode * 
 {
 	struct kobject * kobj = to_kobj(filp->f_path.dentry->d_parent);
 	struct attribute * attr = to_attr(filp->f_path.dentry);
-	struct module * owner = attr->owner;
 	struct sysfs_buffer * buffer = filp->private_data;
 
 	if (buffer)
 		remove_from_collection(buffer, inode);
 	kobject_put(kobj);
 	/* After this point, attr should not be accessed. */
-	module_put(owner);
 
 	if (buffer) {
 		if (buffer->page)
@@ -615,7 +606,6 @@ static void sysfs_schedule_callback_work
 
 	(ss->func)(ss->data);
 	kobject_put(ss->kobj);
-	module_put(ss->owner);
 	kfree(ss);
 }
 
@@ -644,11 +634,8 @@ int sysfs_schedule_callback(struct kobje
 {
 	struct sysfs_schedule_callback_struct *ss;
 
-	if (!try_module_get(owner))
-		return -ENODEV;
 	ss = kmalloc(sizeof(*ss), GFP_KERNEL);
 	if (!ss) {
-		module_put(owner);
 		return -ENOMEM;
 	}
 	kobject_get(kobj);

  reply	other threads:[~2007-12-13 16:51 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30 13:02 2.6.22.14 oops msg with commvault galaxy ? Vincent Fortier
2007-11-30 17:12 ` Randy Dunlap
2007-11-30 17:35   ` Fortier,Vincent [Montreal]
2007-12-04 13:47     ` Vincent Fortier
2007-12-07 22:15       ` Randy Dunlap
2007-12-07 23:11         ` Andrew Morton
2007-12-08  1:14           ` Randy Dunlap
2007-12-10 13:20             ` Fortier,Vincent [Montreal]
2007-12-10 14:03               ` Fortier,Vincent [Montreal]
2007-12-10 17:15                 ` Randy Dunlap
2007-12-10 17:55                   ` Fortier,Vincent [Montreal]
2007-12-11 14:54                   ` Dhaval Giani
2007-12-11 16:43                     ` Dhaval Giani
2007-12-11 17:04                       ` Greg KH
2007-12-11 17:23                         ` Dhaval Giani
2007-12-11 17:47                           ` Fortier,Vincent [Montreal]
2007-12-11 18:20                             ` Dhaval Giani
2007-12-11 18:25                               ` Dhaval Giani
2007-12-11 19:08                                 ` Fortier,Vincent [Montreal]
2007-12-11 19:12                                   ` Randy Dunlap
2007-12-11 21:06                                   ` Ingo Molnar
2007-12-12  7:08                                     ` Dhaval Giani
2007-12-12 12:57                                       ` Fortier,Vincent [Montreal]
2007-12-12 13:05                                         ` Fortier,Vincent [Montreal]
2007-12-12 13:41                                         ` Dhaval Giani
2007-12-12 18:45                                           ` Fortier,Vincent [Montreal]
2007-12-13 11:43                                             ` Dhaval Giani
2007-12-13 12:55                                               ` Ingo Molnar
2007-12-13 13:02                                                 ` Dhaval Giani
2007-12-13 13:12                                                   ` Ingo Molnar
2007-12-13 13:43                                                     ` Vincent Fortier
2007-12-13 13:24                                                   ` Vincent Fortier
2007-12-13 14:41                                                     ` Dhaval Giani
2007-12-13 13:59                                                 ` Kay Sievers
2007-12-13 15:02                                                   ` Vincent Fortier
2007-12-13 16:23                                                     ` Kay Sievers
2007-12-13 16:50                                                       ` Ingo Molnar [this message]
2007-12-13 17:10                                                         ` Kay Sievers
2007-12-13 20:21                                                           ` Ingo Molnar
2007-12-14  2:14                                                             ` Dhaval Giani
2007-12-14 16:26                                                             ` Greg KH
2007-12-14 17:07                                                               ` Dhaval Giani
2007-12-14 17:28                                                                 ` Greg KH
2007-12-20 13:49                                                                   ` Vincent Fortier
2007-12-13 17:20                                                         ` Dhaval Giani
2007-12-11 19:31                           ` 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=20071213165059.GC4865@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@in.ibm.com \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=gregkh@suse.de \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=randy.dunlap@oracle.com \
    --cc=vatsa@linux.vnet.ibm.com \
    --cc=vincent.fortier1@ec.gc.ca \
    /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