diff mbox series

[kmod,13/13] libkmod: always fallback to do_init_module()

Message ID 20240212-decompression-fixes-v1-13-06f92ad07985@gmail.com (mailing list archive)
State New
Headers show
Series Load compressed modules with compression-less kmod | expand

Commit Message

Emil Velikov via B4 Relay Feb. 12, 2024, 5:23 p.m. UTC
From: Emil Velikov <emil.l.velikov@gmail.com>

Since the direct loading was introduced a few bugs became obvious that
the compression args used were off - both in-kernel and dkms.

While both of those are fixed already, not all of those have reached all
users. For example: for dkms I'm aiming to do a release just as kmod has
theirs (to align /lib/modules <> /usr/lib/modules support).

Although I am wondering if we can indiscriminatingly callback to the old
do_init_module() in all the cases. This means that we'll catch any
in-kernel decompression issues - invalid args, ENOMEM, other....
Although for others (wrong magic, perm, etc) we will end up doing the
exact kernel work twice.

Overall the trade-off seems worth it, so flip this.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 libkmod/libkmod-module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index d309948..2c0d46d 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -980,7 +980,7 @@  KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
 	}
 
 	err = do_finit_module(mod, flags, args);
-	if (err == -ENOSYS)
+	if (err)
 		err = do_init_module(mod, flags, args);
 
 	if (err < 0)