Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0b561ee authored by Jiri Kosina's avatar Jiri Kosina
Browse files

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: default avatarFengguang Wu <fengguang.wu@intel.com>
Reported-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarSeth Jennings <sjenning@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 1d9c5d79
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
	func->state = KLP_DISABLED;
	func->state = KLP_DISABLED;


	return kobject_init_and_add(&func->kobj, &klp_ktype_func,
	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 */
/* 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)
	patch->state = KLP_DISABLED;
	patch->state = KLP_DISABLED;


	ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch,
	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)
	if (ret)
		goto unlock;
		goto unlock;