OSDN Git Service

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:34:49 +0000 (08:34 +0100)
commitc371b1e41f1392bb7a054712a412bd0a484fbed0
tree75737acd2c3e9bba1a725ebc421ee9dfa5838278
parentf60d37409adab0034941b8670703e7560cde3660
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