[LEDE-DEV] [PATCH ubox 6/6] kmodloader: make insert_module() idempotent
Yousong Zhou
yszhou4tech at gmail.com
Wed Jan 11 03:54:10 PST 2017
To fix spurious error messages in the following situation
1. scan loaded modules
2. load wireguard.ko and the module itself will request xt_hashlimit to
be loaded
3. xt_hashlimit is still in PROBE state here so we also try to load it,
but init_module() returns EEXIST
Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
kmodloader.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kmodloader.c b/kmodloader.c
index e1e4e68..036213e 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -574,8 +574,11 @@ static int insert_module(char *path, const char *options)
}
data = malloc(s.st_size);
- if (read(fd, data, s.st_size) == s.st_size)
+ if (read(fd, data, s.st_size) == s.st_size) {
ret = syscall(__NR_init_module, data, (unsigned long) s.st_size, options);
+ if (errno == EEXIST)
+ ret = 0;
+ }
else
ULOG_ERR("failed to read full module %s\n", path);
--
2.6.4
More information about the Lede-dev
mailing list