History

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.

Jiri Kosina committed 11 years ago

Commit e0b561e1 parent 1d9c5d71 file · +2 −2Browse files

Showing the changes to kernel/livepatch (1 of 1 file). Show all

Unified · Split

kernel/livepatch/core.c+2−2
@@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func) · 730 unmodified lines
731731 func->state = KLP_DISABLED;
732732
733733 return kobject_init_and_add(&func->kobj, &klp_ktype_func,
734− obj->kobj, func->old_name);
734+ obj->kobj, "%s", func->old_name);
735735 }
736736
737737 /* 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) · 69 unmodified lines
807807 patch->state = KLP_DISABLED;
808808
809809 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);
811811 if (ret)
812812 goto unlock;
813813