aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2008-05-08 17:41:00 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-16 12:24:52 -0400
commit030c1d2bfcc2187650fb975456ca0b61a5bb77f4 (patch)
tree40ed27ce25cf8cbb6b8d3fdb8e25accc17b098c3 /include/linux
parent8c0e3998f5b71e68fe6b6e489a92e052715e563c (diff)
kobject: Fix kobject_rename and !CONFIG_SYSFS
When looking at kobject_rename I found two bugs with that exist when sysfs support is disabled in the kernel. kobject_rename does not change the name on the kobject when sysfs support is not compiled in. kobject_rename without locking attempts to check the validity of a rename operation, which the kobject layer simply does not have the infrastructure to do. This patch documents the previously unstated requirement of kobject_rename that is the responsibility of the caller to provide mutual exclusion and to be certain that the new_name for the kobject is valid. This patch modifies sysfs_rename_dir in !CONFIG_SYSFS case to call kobject_set_name to actually change the kobject_name. This patch removes the bogus and misleading check in kobject_rename that attempts to see if a rename is valid. The check is bogus because we do not have the proper locking. The check is misleading because it looks like we can and do perform checking at the kobject level that we don't. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sysfs.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index b330e289d71f..39924a962207 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -20,6 +20,8 @@
20struct kobject; 20struct kobject;
21struct module; 21struct module;
22 22
23extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
24 __attribute__((format(printf, 2, 3)));
23/* FIXME 25/* FIXME
24 * The *owner field is no longer used, but leave around 26 * The *owner field is no longer used, but leave around
25 * until the tree gets cleaned up fully. 27 * until the tree gets cleaned up fully.
@@ -147,7 +149,7 @@ static inline void sysfs_remove_dir(struct kobject *kobj)
147 149
148static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) 150static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name)
149{ 151{
150 return 0; 152 return kobject_set_name(kobj, "%s", new_name);
151} 153}
152 154
153static inline int sysfs_move_dir(struct kobject *kobj, 155static inline int sysfs_move_dir(struct kobject *kobj,