linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] sysfs: don't call notify_change
@ 2008-06-16 11:46 Miklos Szeredi
  2008-06-16 20:59 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Miklos Szeredi @ 2008-06-16 11:46 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, linux-fsdevel

Greg,

Could you please take this patch into your 2.6.27 queue?

Thanks,
Miklos

--
From: Miklos Szeredi <mszeredi@suse.cz>

sysfs_chmod_file() calls notify_change() to change the permission bits
on a sysfs file.  Replace with explicit call to sysfs_setattr() and
fsnotify_change().

This is equivalent, except that security_inode_setattr() is not
called.  This function is called by drivers, so the security checks do
not make any sense.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 fs/sysfs/file.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6/fs/sysfs/file.c
===================================================================
--- linux-2.6.orig/fs/sysfs/file.c	2008-06-09 19:16:45.000000000 +0200
+++ linux-2.6/fs/sysfs/file.c	2008-06-09 19:49:49.000000000 +0200
@@ -14,6 +14,7 @@
 #include <linux/kobject.h>
 #include <linux/kallsyms.h>
 #include <linux/slab.h>
+#include <linux/fsnotify.h>
 #include <linux/namei.h>
 #include <linux/poll.h>
 #include <linux/list.h>
@@ -585,9 +586,11 @@ int sysfs_chmod_file(struct kobject *kob
 
 	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
 	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-	rc = notify_change(victim, &newattrs);
+	newattrs.ia_ctime = current_fs_time(inode->i_sb);
+	rc = sysfs_setattr(victim, &newattrs);
 
 	if (rc == 0) {
+		fsnotify_change(victim, newattrs.ia_valid);
 		mutex_lock(&sysfs_mutex);
 		victim_sd->s_mode = newattrs.ia_mode;
 		mutex_unlock(&sysfs_mutex);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] sysfs: don't call notify_change
  2008-06-16 11:46 [patch] sysfs: don't call notify_change Miklos Szeredi
@ 2008-06-16 20:59 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2008-06-16 20:59 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-kernel, linux-fsdevel

On Mon, Jun 16, 2008 at 01:46:47PM +0200, Miklos Szeredi wrote:
> Greg,
> 
> Could you please take this patch into your 2.6.27 queue?

Sure, would be glad to.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-16 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-16 11:46 [patch] sysfs: don't call notify_change Miklos Szeredi
2008-06-16 20:59 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).