diff options
| author | Vignesh Viswanathan <viswanat@codeaurora.org> | 2018-05-17 19:56:39 +0530 |
|---|---|---|
| committer | nshrivas <nshrivas@codeaurora.org> | 2018-05-30 07:33:26 -0700 |
| commit | 47ae12c0aa2e5a0aa3abeba23b4e9a443b5f9e93 (patch) | |
| tree | 953e1ef79de626dbafeb4301a84117cfc8908e07 /core/utils | |
| parent | 34770e6a35a6bbc3853fc447816128316017be3c (diff) | |
qcacld-3.0: Deregister NL MSG handlers during hdd_wlan_exit
Currently the NL MSG handlers for WLAN_NL_MSG_OEM,
WLAN_NL_MSG_SPECTRAL_SCAN, WLAN_NL_MSG_CNSS_DIAG, ANI_NL_MSG_PUMAC and
ANI_NL_MSG_PTT are not deregistered during hdd_wlan_exit which can
causes a page fault if NL issues cld80211_doit for these NL messages
when the WLAN is not up.
Add Deregsiter APIs for all the NL MSGs to call as part of
hdd_exit_netlink_services during hdd_wlan_exit.
Change-Id: I5811dcfc79eff4ea7281de5f7591e078c572e69c
CRs-Fixed: 2232902
Diffstat (limited to 'core/utils')
| -rw-r--r-- | core/utils/fwlog/dbglog_host.c | 51 | ||||
| -rw-r--r-- | core/utils/fwlog/dbglog_host.h | 21 | ||||
| -rw-r--r-- | core/utils/ptt/inc/wlan_ptt_sock_svc.h | 30 | ||||
| -rw-r--r-- | core/utils/ptt/src/wlan_ptt_sock_svc.c | 34 |
4 files changed, 78 insertions, 58 deletions
diff --git a/core/utils/fwlog/dbglog_host.c b/core/utils/fwlog/dbglog_host.c index 04d92c3f0f00..7e5257faf48c 100644 --- a/core/utils/fwlog/dbglog_host.c +++ b/core/utils/fwlog/dbglog_host.c @@ -4237,20 +4237,18 @@ static void cnss_diag_cmd_handler(const void *data, int data_len, return; } -/** - * cnss_diag_activate_service() - API to register CNSS diag cmd handler - * - * API to register the CNSS diag command handler using new genl infra. - * Return type is zero to match with legacy prototype - * - * Return: 0 - */ int cnss_diag_activate_service(void) { register_cld_cmd_cb(WLAN_NL_MSG_CNSS_DIAG, cnss_diag_cmd_handler, NULL); return 0; } +int cnss_diag_deactivate_service(void) +{ + deregister_cld_cmd_cb(WLAN_NL_MSG_CNSS_DIAG); + return 0; +} + #else /** @@ -4282,30 +4280,35 @@ static int cnss_diag_msg_callback(struct sk_buff *skb) return 0; } -/** - * brief cnss_diag_activate_service() - Activate cnss_diag message handler - * - * This function registers a handler to receive netlink message from - * an cnss-diag application process. - * - * param - - * - None - * - * return - 0 for success, non zero for failure - */ int cnss_diag_activate_service(void) { - int ret = 0; + int ret; /* Register the msg handler for msgs addressed to WLAN_NL_MSG_OEM */ ret = nl_srv_register(WLAN_NL_MSG_CNSS_DIAG, cnss_diag_msg_callback); - if (ret) { + if (ret) AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("CNSS-DIAG Registration failed")); - return ret; - } - return 0; + + return ret; } + +int cnss_diag_deactivate_service(void) +{ + int ret; + + /* + * Deregister the msg handler for msgs addressed to + * WLAN_NL_MSG_CNSS_DIAG + */ + ret = nl_srv_unregister(WLAN_NL_MSG_CNSS_DIAG, cnss_diag_msg_callback); + if (ret) + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("CNSS-DIAG Registration failed")); + + return ret; +} + #endif static A_BOOL diff --git a/core/utils/fwlog/dbglog_host.h b/core/utils/fwlog/dbglog_host.h index fe4617acc2c4..be6c1ddc267b 100644 --- a/core/utils/fwlog/dbglog_host.h +++ b/core/utils/fwlog/dbglog_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2011, 2014-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -159,9 +159,26 @@ dbglog_parse_debug_logs(ol_scn_t scn, u_int8_t *datap, u_int32_t len); -/** Register the cnss_diag activate with the wlan driver */ +/** + * cnss_diag_activate_service() - API to register CNSS diag cmd handler + * + * API to register the handler for the NL message received from cnss_diag + * application. + * + * Return: 0 + */ int cnss_diag_activate_service(void); +/** + * cnss_diag_deactivate_service() - API to deregister CNSS diag cmd handler + * + * API to deregister the handler for the NL message received from cnss_diag + * application. + * + * Return: 0 + */ +int cnss_diag_deactivate_service(void); + #ifdef __cplusplus } #endif diff --git a/core/utils/ptt/inc/wlan_ptt_sock_svc.h b/core/utils/ptt/inc/wlan_ptt_sock_svc.h index 0ff8e26d8137..d476ae35226f 100644 --- a/core/utils/ptt/inc/wlan_ptt_sock_svc.h +++ b/core/utils/ptt/inc/wlan_ptt_sock_svc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -88,12 +88,34 @@ * Payload : LEN_PAYLOAD bytes */ #ifdef PTT_SOCK_SVC_ENABLE -int ptt_sock_activate_svc(void); + +/** + * ptt_sock_activate_svc() - API to register PTT/PUMAC command handlers + * + * API to register the handler for PTT/PUMAC NL messages. + * + * Return: None + */ +void ptt_sock_activate_svc(void); + +/** + * ptt_sock_deactivate_svc() - API to deregister PTT/PUMAC command handlers + * + * API to deregister the handler for PTT/PUMAC NL messages. + * + * Return: None + */ void ptt_sock_deactivate_svc(void); int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid); #else -static inline int ptt_sock_activate_svc(void) { return 0; } -static inline void ptt_sock_deactivate_svc(void) { return; } +static inline void ptt_sock_activate_svc(void) +{ +} + +static inline void ptt_sock_deactivate_svc(void) +{ +} + static inline int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid) { diff --git a/core/utils/ptt/src/wlan_ptt_sock_svc.c b/core/utils/ptt/src/wlan_ptt_sock_svc.c index 32b66cec0309..413b0f062df0 100644 --- a/core/utils/ptt/src/wlan_ptt_sock_svc.c +++ b/core/utils/ptt/src/wlan_ptt_sock_svc.c @@ -306,52 +306,30 @@ static void ptt_cmd_handler(const void *data, int data_len, void *ctx, int pid) } } -/** - * ptt_sock_activate_svc() - API to register PTT/PUMAC command handler - * - * API to register the PTT/PUMAC command handlers. Argument @pAdapter - * is sent for prototype compatibility between new genl and legacy - * implementation - * - * Return: 0 - */ -int ptt_sock_activate_svc(void) +void ptt_sock_activate_svc(void) { register_cld_cmd_cb(ANI_NL_MSG_PUMAC, ptt_cmd_handler, NULL); register_cld_cmd_cb(ANI_NL_MSG_PTT, ptt_cmd_handler, NULL); - return 0; } -/** - * ptt_sock_deactivate_svc() - Dummy API to deactivate PTT service - * - * Return: Void - */ void ptt_sock_deactivate_svc(void) { + deregister_cld_cmd_cb(ANI_NL_MSG_PTT); + deregister_cld_cmd_cb(ANI_NL_MSG_PUMAC); } #else -/** - * ptt_sock_activate_svc() - activate PTT service - * - * Return: 0 - */ -int ptt_sock_activate_svc(void) +void ptt_sock_activate_svc(void) { ptt_pid = INVALID_PID; nl_srv_register(ANI_NL_MSG_PUMAC, ptt_sock_rx_nlink_msg); nl_srv_register(ANI_NL_MSG_PTT, ptt_sock_rx_nlink_msg); - return 0; } -/** - * ptt_sock_deactivate_svc() - deactivate PTT service - * - * Return: Void - */ void ptt_sock_deactivate_svc(void) { + nl_srv_unregister(ANI_NL_MSG_PTT, ptt_sock_rx_nlink_msg); + nl_srv_unregister(ANI_NL_MSG_PUMAC, ptt_sock_rx_nlink_msg); ptt_pid = INVALID_PID; } #endif |
