]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
module: Override -EEXIST module return
authorLucas De Marchi <demarchi@kernel.org>
Mon, 30 Mar 2026 13:13:51 +0000 (08:13 -0500)
committerSami Tolvanen <samitolvanen@google.com>
Sat, 4 Apr 2026 00:04:42 +0000 (00:04 +0000)
commit743f8cae549affe8eafb021b8c0e78a9f3bc23fa
tree32b7961f7377f1ec1dc6eb8bc37c4465f71a7f14
parent3b1299f25b07ef83e020d049dfc62ced9c09450d
module: Override -EEXIST module return

The -EEXIST errno is reserved by the module loading functionality. When
userspace calls [f]init_module(), it expects a -EEXIST to mean that the
module is already loaded in the kernel. If module_init() returns it,
that is not true anymore.

Override the error when returning to userspace: it doesn't make sense to
change potentially long error propagation call chains just because it's
will end up as the return of module_init().

Closes: https://lore.kernel.org/all/aKLzsAX14ybEjHfJ@orbyte.nwl.cc/
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Petr Pavlu <petr.pavlu@suse.com>
Cc: Daniel Gomez <da.gomez@samsung.com>
Cc: Phil Sutter <phil@nwl.cc>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
[Sami: Fixed a typo.]
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
kernel/module/main.c