summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-06-06 22:52:19 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-08 01:05:50 +0200
commitb7165ebbf0898bad9aaeddfa22b918e94ed90e07 (patch)
tree1256297e5ed27757724770a5f6f5a40589be031f
parentsysfs_notify is only possible on file attributes (diff)
downloadlinux-b7165ebbf0898bad9aaeddfa22b918e94ed90e07.tar.xz
linux-b7165ebbf0898bad9aaeddfa22b918e94ed90e07.zip
kobject: sanitize argument for format string
Unlike kobject_set_name(), the kset_create_and_add() interface does not provide a way to use format strings, so make sure that the interface cannot be abused accidentally. It looks like all current callers use static strings, so there's no existing flaw. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--lib/kobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index b7e29a6056d3..4a1f33d43548 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -805,7 +805,7 @@ static struct kset *kset_create(const char *name,
kset = kzalloc(sizeof(*kset), GFP_KERNEL);
if (!kset)
return NULL;
- retval = kobject_set_name(&kset->kobj, name);
+ retval = kobject_set_name(&kset->kobj, "%s", name);
if (retval) {
kfree(kset);
return NULL;