Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: crypto: replace -EEXIST with -EBUSY

The -EEXIST error code is reserved by the module loading infrastructure
to indicate that a module is already loaded. When a module's init
function returns -EEXIST, userspace tools like kmod interpret this as
"module already loaded" and treat the operation as successful, returning
0 to the user even though the module initialization actually failed.

This follows the precedent set by commit 54416fd76770 ("netfilter:
conntrack: helper: Replace -EEXIST by -EBUSY") which fixed the same
issue in nf_conntrack_helper_register().

This affects bpf_crypto_skcipher module. While the configuration
required to build it as a module is unlikely in practice, it is
technically possible, so fix it for correctness.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Acked-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://lore.kernel.org/r/20251220-dev-module-init-eexists-bpf-v1-1-7f186663dbe7@samsung.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Daniel Gomez and committed by
Alexei Starovoitov
ac1c5bc7 b0004a82

+1 -1
+1 -1
kernel/bpf/crypto.c
··· 60 60 int bpf_crypto_register_type(const struct bpf_crypto_type *type) 61 61 { 62 62 struct bpf_crypto_type_list *node; 63 - int err = -EEXIST; 63 + int err = -EBUSY; 64 64 65 65 down_write(&bpf_crypto_types_sem); 66 66 list_for_each_entry(node, &bpf_crypto_types, list) {