diff options
author | Ajit Kumar <kajit@qti.qualcomm.com> | 2017-07-31 16:53:46 +0530 |
---|---|---|
committer | Ahmed ElArabawy <arabawy@google.com> | 2017-11-17 18:57:30 -0800 |
commit | 93c106de19af6a648c26e4d5f0cd0502740b4c51 (patch) | |
tree | 2a78e45464ae19d1e908913884949710c4a7eca6 /libwifi_hal | |
parent | f06c5fd63f0866551adfc151ea5842946ad1c078 (diff) | |
download | android_frameworks_opt_net_wifi-93c106de19af6a648c26e4d5f0cd0502740b4c51.tar.gz android_frameworks_opt_net_wifi-93c106de19af6a648c26e4d5f0cd0502740b4c51.tar.bz2 android_frameworks_opt_net_wifi-93c106de19af6a648c26e4d5f0cd0502740b4c51.zip |
Use finit_module syscall to perform insmod operation
Bug: 64383078
Bug: 68050181
Test: Manual Test
Change-Id: I57c168a8008de5ce38eb14a3a2bc7d7fdde602a7
Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
Diffstat (limited to 'libwifi_hal')
-rw-r--r-- | libwifi_hal/wifi_hal_common.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libwifi_hal/wifi_hal_common.cpp b/libwifi_hal/wifi_hal_common.cpp index 04e592595..413daf7da 100644 --- a/libwifi_hal/wifi_hal_common.cpp +++ b/libwifi_hal/wifi_hal_common.cpp @@ -23,6 +23,7 @@ #include <android-base/logging.h> #include <cutils/misc.h> #include <cutils/properties.h> +#include <sys/syscall.h> extern "C" int init_module(void *, unsigned long, const char *); extern "C" int delete_module(const char *, unsigned int); @@ -51,16 +52,21 @@ static const char MODULE_FILE[] = "/proc/modules"; #endif static int insmod(const char *filename, const char *args) { - void *module; - unsigned int size; int ret; + int fd; - module = load_file(filename, &size); - if (!module) return -1; + fd = TEMP_FAILURE_RETRY(open(filename, O_RDONLY | O_CLOEXEC | O_NOFOLLOW)); + if (fd < 0) { + PLOG(ERROR) << "Failed to open " << filename; + return -1; + } - ret = init_module(module, size, args); + ret = syscall(__NR_finit_module, fd, args, 0); - free(module); + close(fd); + if (ret < 0) { + PLOG(ERROR) << "finit_module return: " << ret; + } return ret; } |