Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.

A recent patch from Kay Sievers <kay.sievers@vrfy.org>
replaced the first occurrence of '/' with '!' as needed for block devices.

Now do some cheap defensive coding and replace all of them to avoid future
issues in this area.

Signed-off-by: Ingo Oeser <ioe-lkml@rameria.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Ingo Oeser and committed by
Greg Kroah-Hartman
25fdeb3f 6a55617e

+1 -2
+1 -2
lib/kobject.c
··· 223 223 return -ENOMEM; 224 224 225 225 /* ewww... some of these buggers have '/' in the name ... */ 226 - s = strchr(kobj->name, '/'); 227 - if (s) 226 + while ((s = strchr(kobj->name, '/'))) 228 227 s[0] = '!'; 229 228 230 229 kfree(old_name);