Re: 2.6.22.14 oops msg with commvault galaxy ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Kay Sievers <[email protected]> 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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux