]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
module: Prevent silent truncation of module name in delete_module(2)
authorPetr Pavlu <petr.pavlu@suse.com>
Mon, 30 Jun 2025 14:32:32 +0000 (16:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:26:01 +0000 (16:26 +0200)
commit19699c3bc7253e801905b0b94f8df0ff4976f6b9
tree28da75d72b4ef77250fa809b7ae0b82b4f99bf76
parentde012fce2c231434706fb09a89c7009154bad27d
module: Prevent silent truncation of module name in delete_module(2)

[ Upstream commit a6323bd4e611567913e23df5b58f2d4e4da06789 ]

Passing a module name longer than MODULE_NAME_LEN to the delete_module
syscall results in its silent truncation. This really isn't much of
a problem in practice, but it could theoretically lead to the removal of an
incorrect module. It is more sensible to return ENAMETOOLONG or ENOENT in
such a case.

Update the syscall to return ENOENT, as documented in the delete_module(2)
man page to mean "No module by that name exists." This is appropriate
because a module with a name longer than MODULE_NAME_LEN cannot be loaded
in the first place.

Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
Link: https://lore.kernel.org/r/20250630143535.267745-2-petr.pavlu@suse.com
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/module/main.c