aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kobject.c')
-rw-r--r--lib/kobject.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index dcade0543bd2..744401571ed7 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -216,13 +216,19 @@ static int kobject_add_internal(struct kobject *kobj)
216static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, 216static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
217 va_list vargs) 217 va_list vargs)
218{ 218{
219 /* Free the old name, if necessary. */ 219 const char *old_name = kobj->name;
220 kfree(kobj->name); 220 char *s;
221 221
222 kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); 222 kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
223 if (!kobj->name) 223 if (!kobj->name)
224 return -ENOMEM; 224 return -ENOMEM;
225 225
226 /* ewww... some of these buggers have '/' in the name ... */
227 s = strchr(kobj->name, '/');
228 if (s)
229 s[0] = '!';
230
231 kfree(old_name);
226 return 0; 232 return 0;
227} 233}
228 234