summaryrefslogtreecommitdiffstats
path: root/lib/kobject.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-30 22:23:27 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-30 22:23:27 -0700
commita3634d7169f56eca5e349fce2f1de228fc10efda (patch)
treef15da7d958c111cab9e36ede4a7044f52a88f6ff /lib/kobject.c
parent53173920dab204a31ef37e7d2cb25b964a8a7752 (diff)
parent710701c8fc4f6e0c67a98a0b9ca0d75656115957 (diff)
downloadkernel-crypto-a3634d7169f56eca5e349fce2f1de228fc10efda.tar.gz
kernel-crypto-a3634d7169f56eca5e349fce2f1de228fc10efda.tar.xz
kernel-crypto-a3634d7169f56eca5e349fce2f1de228fc10efda.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: add SubmittingPatches to Documentation/ja_JP fix typo in SubmittingPatches Driver Core: fix bug in device_rename() for SYSFS_DEPRECATED=y sysfs: make sysfs_{get,put}_active() static kobject: check for duplicate names in kobject_rename Driver core: remove class_device_*_bin_file
Diffstat (limited to 'lib/kobject.c')
-rw-r--r--lib/kobject.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 03d40360ff1..a7e3bf4d3c7 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -308,6 +308,19 @@ int kobject_rename(struct kobject * kobj, const char *new_name)
if (!kobj->parent)
return -EINVAL;
+ /* see if this name is already in use */
+ if (kobj->kset) {
+ struct kobject *temp_kobj;
+ temp_kobj = kset_find_obj(kobj->kset, new_name);
+ if (temp_kobj) {
+ printk(KERN_WARNING "kobject '%s' can not be renamed "
+ "to '%s' as '%s' is already in existance.\n",
+ kobject_name(kobj), new_name, new_name);
+ kobject_put(temp_kobj);
+ return -EINVAL;
+ }
+ }
+
devpath = kobject_get_path(kobj, GFP_KERNEL);
if (!devpath) {
error = -ENOMEM;