module: avoid setting info->name early in case we can fall back to info->mod->name
authorJessica Yu <jeyu@kernel.org>
Fri, 17 Jan 2020 12:32:21 +0000 (13:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:54 +0000 (08:36 +0100)
commit496d6c021828c712ec0870e704a61fa1f8e86546
tree553b9c18ba6a73f8f1c4510fe784e7c3ff180993
parent7303a0b0a537c114648f5f4ba305d396460bc68d
module: avoid setting info->name early in case we can fall back to info->mod->name

[ Upstream commit 708e0ada1916be765b7faa58854062f2bc620bbf ]

In setup_load_info(), info->name (which contains the name of the module,
mostly used for early logging purposes before the module gets set up)
gets unconditionally assigned if .modinfo is missing despite the fact
that there is an if (!info->name) check near the end of the function.
Avoid assigning a placeholder string to info->name if .modinfo doesn't
exist, so that we can fall back to info->mod->name later on.

Fixes: 5fdc7db6448a ("module: setup load info before module_sig_check()")
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/module.c