summaryrefslogtreecommitdiff
path: root/qcwcn/wifi_hal/wifi_hal.cpp
diff options
context:
space:
mode:
authorAjit Vaishya <ajitv@codeaurora.org>2019-03-29 21:39:08 +0530
committerVictor Hsu <hsuvictor@google.com>2019-04-19 11:46:51 +0000
commit35c34d329cef989f6cf881238f2613859a77fd54 (patch)
tree36225568821b171c0a3347b1a92de075aa6161c6 /qcwcn/wifi_hal/wifi_hal.cpp
parent3929c85d870259884a13c6efe3c05e6b97cae649 (diff)
downloadwlan-35c34d329cef989f6cf881238f2613859a77fd54.tar.gz
Wifi-Hal: Pass the address of the global variable to NL callback
Current implementation passes the address of a local variable to the netlink control block callback, ending up to go out of scope if the callback is invoked after the scope for the current function ends (from where the registration happened), resulting in an invalid memory access. Address this issue by having the respective variable defined with a global scope. Change-Id: Ied10a8f17f20326864f80ac40b0ceac6791f6cd1 CRs-Fixed: 2427930 Bug: 129092516 Test: Manual test
Diffstat (limited to 'qcwcn/wifi_hal/wifi_hal.cpp')
-rw-r--r--qcwcn/wifi_hal/wifi_hal.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp
index 0881c0b..198ab01 100644
--- a/qcwcn/wifi_hal/wifi_hal.cpp
+++ b/qcwcn/wifi_hal/wifi_hal.cpp
@@ -487,7 +487,6 @@ static int wifi_get_iface_id(hal_info *info, const char *iface)
wifi_error wifi_initialize(wifi_handle *handle)
{
- int err = 0;
wifi_error ret = WIFI_SUCCESS;
wifi_interface_handle iface_handle;
struct nl_sock *cmd_sock = NULL;
@@ -544,11 +543,11 @@ wifi_error wifi_initialize(wifi_handle *handle)
goto unload;
}
- err = 1;
+ info->event_sock_arg = 1;
nl_cb_set(cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL);
- nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err);
- nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err);
- nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, &err);
+ nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &info->event_sock_arg);
+ nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &info->event_sock_arg);
+ nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, &info->event_sock_arg);
nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, internal_valid_message_handler,
info);