diff options
author | Ajit Vaishya <ajitv@codeaurora.org> | 2019-03-29 21:39:08 +0530 |
---|---|---|
committer | Victor Hsu <hsuvictor@google.com> | 2019-04-19 11:46:51 +0000 |
commit | 35c34d329cef989f6cf881238f2613859a77fd54 (patch) | |
tree | 36225568821b171c0a3347b1a92de075aa6161c6 /qcwcn/wifi_hal | |
parent | 3929c85d870259884a13c6efe3c05e6b97cae649 (diff) | |
download | wlan-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')
-rw-r--r-- | qcwcn/wifi_hal/common.h | 1 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wifi_hal.cpp | 9 |
2 files changed, 5 insertions, 5 deletions
diff --git a/qcwcn/wifi_hal/common.h b/qcwcn/wifi_hal/common.h index 0b3a765..759ae01 100644 --- a/qcwcn/wifi_hal/common.h +++ b/qcwcn/wifi_hal/common.h @@ -133,6 +133,7 @@ typedef struct hal_info_s { u32 supported_logger_feature_set; // add other details int user_sock_arg; + int event_sock_arg; struct rb_info rb_infos[NUM_RING_BUFS]; void (*on_ring_buffer_data) (char *ring_name, char *buffer, int buffer_size, wifi_ring_buffer_status *status); 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); |