diff options
author | Jiri Kosina <jkosina@suse.cz> | 2015-02-15 04:03:20 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-02-16 10:26:56 -0500 |
commit | e0b561ee78d82a4cc7792aa28fa4b1ea15325dcc (patch) | |
tree | e11dc662c90bc42ee17d358f0f79eb914dfbb119 /kernel | |
parent | 1d9c5d79e6e4385aea6f69c23ba543717434ed70 (diff) |
livepatch: fix format string in kobject_init_and_add()
kobject_init_and_add() takes expects format string for a name, so we
better provide it in order to avoid infoleaks if modules craft their
mod->name in a special way.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reported-by: Kees Cook <keescook@chromium.org>
Acked-by: Seth Jennings <sjenning@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/livepatch/core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index ff7f47d026ac..69bf3aa3bde8 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c | |||
@@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func) | |||
731 | func->state = KLP_DISABLED; | 731 | func->state = KLP_DISABLED; |
732 | 732 | ||
733 | return kobject_init_and_add(&func->kobj, &klp_ktype_func, | 733 | return kobject_init_and_add(&func->kobj, &klp_ktype_func, |
734 | obj->kobj, func->old_name); | 734 | obj->kobj, "%s", func->old_name); |
735 | } | 735 | } |
736 | 736 | ||
737 | /* parts of the initialization that is done only when the object is loaded */ | 737 | /* parts of the initialization that is done only when the object is loaded */ |
@@ -807,7 +807,7 @@ static int klp_init_patch(struct klp_patch *patch) | |||
807 | patch->state = KLP_DISABLED; | 807 | patch->state = KLP_DISABLED; |
808 | 808 | ||
809 | ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, | 809 | ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, |
810 | klp_root_kobj, patch->mod->name); | 810 | klp_root_kobj, "%s", patch->mod->name); |
811 | if (ret) | 811 | if (ret) |
812 | goto unlock; | 812 | goto unlock; |
813 | 813 | ||