diff options
author | Ron Yorston <rmy@pobox.com> | 2023-04-09 11:24:09 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-04-09 11:24:09 +0100 |
commit | d9f2ea8628452f787e02dd0e496af612a2e94578 (patch) | |
tree | c12be657e31c2e832b41fbff9a77aa0f886d47f0 /modutils/modutils.c | |
parent | fa04f2dc766c76f2caa44a4b8429185dde6a66b0 (diff) | |
parent | a26711a2d1464167be4ebc990fe21a3809a2da34 (diff) | |
download | busybox-w32-d9f2ea8628452f787e02dd0e496af612a2e94578.tar.gz busybox-w32-d9f2ea8628452f787e02dd0e496af612a2e94578.tar.bz2 busybox-w32-d9f2ea8628452f787e02dd0e496af612a2e94578.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'modutils/modutils.c')
-rw-r--r-- | modutils/modutils.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/modutils/modutils.c b/modutils/modutils.c index f7ad5e805..cbff20961 100644 --- a/modutils/modutils.c +++ b/modutils/modutils.c | |||
@@ -12,6 +12,9 @@ | |||
12 | #define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts) | 12 | #define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts) |
13 | #if defined(__NR_finit_module) | 13 | #if defined(__NR_finit_module) |
14 | # define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags) | 14 | # define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags) |
15 | # ifndef MODULE_INIT_COMPRESSED_FILE | ||
16 | # define MODULE_INIT_COMPRESSED_FILE 4 | ||
17 | # endif | ||
15 | #endif | 18 | #endif |
16 | #define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags) | 19 | #define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags) |
17 | 20 | ||
@@ -217,7 +220,14 @@ int FAST_FUNC bb_init_module(const char *filename, const char *options) | |||
217 | { | 220 | { |
218 | int fd = open(filename, O_RDONLY | O_CLOEXEC); | 221 | int fd = open(filename, O_RDONLY | O_CLOEXEC); |
219 | if (fd >= 0) { | 222 | if (fd >= 0) { |
220 | rc = finit_module(fd, options, 0) != 0; | 223 | int flags = is_suffixed_with(filename, ".ko") ? 0 : MODULE_INIT_COMPRESSED_FILE; |
224 | for (;;) { | ||
225 | rc = finit_module(fd, options, flags); | ||
226 | if (rc == 0 || flags == 0) | ||
227 | break; | ||
228 | /* Loading non-.ko named uncompressed module? Not likely, but let's try it */ | ||
229 | flags = 0; | ||
230 | } | ||
221 | close(fd); | 231 | close(fd); |
222 | if (rc == 0) | 232 | if (rc == 0) |
223 | return rc; | 233 | return rc; |