Skip to content

Commit

Permalink
livepatch: fix format string in kobject_init_and_add()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Kosina committed Feb 16, 2015
1 parent 1d9c5d7 commit e0b561e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/livepatch/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
func->state = KLP_DISABLED;

return kobject_init_and_add(&func->kobj, &klp_ktype_func,
obj->kobj, func->old_name);
obj->kobj, "%s", func->old_name);
}

/* parts of the initialization that is done only when the object is loaded */
Expand Down Expand Up @@ -807,7 +807,7 @@ static int klp_init_patch(struct klp_patch *patch)
patch->state = KLP_DISABLED;

ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch,
klp_root_kobj, patch->mod->name);
klp_root_kobj, "%s", patch->mod->name);
if (ret)
goto unlock;

Expand Down

0 comments on commit e0b561e

Please sign in to comment.