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 | |
| 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
| -rw-r--r-- | core/hdd/inc/wlan_hdd_oemdata.h | 27 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 21 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_oemdata.c | 33 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_spectral.c | 45 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_spectralscan.h | 23 | ||||
| -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 |
9 files changed, 172 insertions, 113 deletions
diff --git a/core/hdd/inc/wlan_hdd_oemdata.h b/core/hdd/inc/wlan_hdd_oemdata.h index c4d7eb948039..580397716691 100644 --- a/core/hdd/inc/wlan_hdd_oemdata.h +++ b/core/hdd/inc/wlan_hdd_oemdata.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 @@ -175,8 +175,27 @@ void hdd_send_peer_status_ind_to_oem_app(struct qdf_mac_addr *peerMac, int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); +/** + * oem_activate_service() - API to register the oem command handler + * @hdd_ctx: Pointer to HDD Context + * + * This API is used to register the handler to receive netlink message + * from an OEM application process + * + * Return: 0 + */ int oem_activate_service(struct hdd_context_s *hdd_ctx); +/** + * oem_deactivate_service() - API to unregister the oem command handler + * + * This API is used to deregister the handler to receive netlink message + * from an OEM application process + * + * Return: 0 + */ +int oem_deactivate_service(void); + void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_rsp); void hdd_update_channel_bw_info(hdd_context_t *hdd_ctx, uint16_t chan, @@ -186,6 +205,12 @@ static inline int oem_activate_service(struct hdd_context_s *hdd_ctx) { return 0; } + +static inline int oem_deactivate_service(void) +{ + return 0; +} + static inline void hdd_update_channel_bw_info(hdd_context_t *hdd_ctx, uint16_t chan, void *hdd_chan_info) {} diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a2722cd41329..772b920f0102 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6227,10 +6227,11 @@ void hdd_unregister_notifiers(hdd_context_t *hdd_ctx) */ static void hdd_exit_netlink_services(hdd_context_t *hdd_ctx) { + spectral_scan_deactivate_service(); + cnss_diag_deactivate_service(); hdd_close_cesium_nl_sock(); - ptt_sock_deactivate_svc(); - + oem_deactivate_service(); nl_srv_exit(); } @@ -6260,15 +6261,13 @@ static int hdd_init_netlink_services(hdd_context_t *hdd_ctx) goto err_nl_srv; } - ret = ptt_sock_activate_svc(); - if (ret) { - hdd_err("ptt_sock_activate_svc failed: %d", ret); - goto err_nl_srv; - } + ptt_sock_activate_svc(); ret = hdd_open_cesium_nl_sock(); - if (ret) + if (ret) { hdd_err("hdd_open_cesium_nl_sock failed ret: %d", ret); + goto err_ptt_sock; + } ret = cnss_diag_activate_service(); if (ret) { @@ -6279,14 +6278,18 @@ static int hdd_init_netlink_services(hdd_context_t *hdd_ctx) ret = spectral_scan_activate_service(); if (ret) { hdd_alert("spectral_scan_activate_service failed: %d", ret); - goto err_close_cesium; + goto err_cnss_diag; } return 0; +err_cnss_diag: + cnss_diag_deactivate_service(); err_close_cesium: hdd_close_cesium_nl_sock(); +err_ptt_sock: ptt_sock_deactivate_svc(); + oem_deactivate_service(); err_nl_srv: nl_srv_exit(); out: diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index 5e2d62ffb2da..c51b554c276f 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -1062,21 +1062,19 @@ static void oem_cmd_handler(const void *data, int data_len, void *ctx, int pid) oem_request_dispatcher(msg_hdr, pid); } -/** - * oem_activate_service() - API to register the oem command handler - * @hdd_ctx: Pointer to HDD Context - * - * This API is used to register the oem app command handler. Argument - * @pAdapter is given for prototype compatibility with legacy code. - * - * Return: 0 - */ int oem_activate_service(struct hdd_context_s *hdd_ctx) { p_hdd_ctx = hdd_ctx; register_cld_cmd_cb(WLAN_NL_MSG_OEM, oem_cmd_handler, NULL); return 0; } + +int oem_deactivate_service(void) +{ + deregister_cld_cmd_cb(WLAN_NL_MSG_OEM); + return 0; +} + #else /* @@ -1143,16 +1141,6 @@ static int __oem_msg_callback(struct sk_buff *skb) return ret; } -/** - * oem_activate_service() - Activate oem message handler - * @hdd_ctx: pointer to global HDD context - * - * This function registers a handler to receive netlink message from - * an OEM application process. - * - * Return: zero on success - * On error, error number will be returned. - */ int oem_activate_service(struct hdd_context_s *hdd_ctx) { p_hdd_ctx = hdd_ctx; @@ -1160,5 +1148,12 @@ int oem_activate_service(struct hdd_context_s *hdd_ctx) /* Register the msg handler for msgs addressed to WLAN_NL_MSG_OEM */ return nl_srv_register(WLAN_NL_MSG_OEM, __oem_msg_callback); } + +int oem_deactivate_service(void) +{ + /* Deregister the msg handler for msgs addressed to WLAN_NL_MSG_OEM */ + return nl_srv_unregister(WLAN_NL_MSG_OEM, __oem_msg_callback); +} + #endif #endif diff --git a/core/hdd/src/wlan_hdd_spectral.c b/core/hdd/src/wlan_hdd_spectral.c index f02c9159bcc9..7b6735d24922 100644 --- a/core/hdd/src/wlan_hdd_spectral.c +++ b/core/hdd/src/wlan_hdd_spectral.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -434,16 +434,6 @@ static void spectral_scan_msg_handler(const void *data, int data_len, cds_ssr_unprotect(__func__); } -/** - * spectral_scan_activate_service() - API to register spectral - * scan cmd handler - * - * API to register the spectral scan command handler using new - * genl infra. Return type is zero to match with legacy - * prototype - * - * Return: 0 - */ int spectral_scan_activate_service(void) { register_cld_cmd_cb(WLAN_NL_MSG_SPECTRAL_SCAN, @@ -451,6 +441,12 @@ int spectral_scan_activate_service(void) return 0; } +int spectral_scan_deactivate_service(void) +{ + deregister_cld_cmd_cb(WLAN_NL_MSG_SPECTRAL_SCAN); + return 0; +} + #else static int spectral_scan_msg_callback(struct sk_buff *skb) { @@ -488,16 +484,6 @@ static int spectral_scan_msg_callback(struct sk_buff *skb) return 0; } -/** - * spectral_scan_activate_service() - Activate spectral scan message handler - * - * This function registers a handler to receive netlink message from - * the spectral scan application process. - * param - - * - None - * - * Return - 0 for success, non zero for failure - */ int spectral_scan_activate_service(void) { int ret; @@ -512,6 +498,23 @@ int spectral_scan_activate_service(void) return ret; } + +int spectral_scan_deactivate_service(void) +{ + int ret; + + /* + * Unregister the msg handler for msgs addressed to + * WLAN_NL_MSG_SPECTRAL_SCAN + */ + ret = nl_srv_unregister(WLAN_NL_MSG_SPECTRAL_SCAN, + spectral_scan_msg_callback); + if (ret) + hdd_err("Spectral Scan Unregistration failed"); + + return ret; +} + #endif /** diff --git a/core/hdd/src/wlan_hdd_spectralscan.h b/core/hdd/src/wlan_hdd_spectralscan.h index 552af910f045..6e61715058a3 100644 --- a/core/hdd/src/wlan_hdd_spectralscan.h +++ b/core/hdd/src/wlan_hdd_spectralscan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -112,16 +112,24 @@ int wlan_hdd_cfg80211_spectral_scan_stop(struct wiphy *wiphy, /** * spectral_scan_activate_service() - Activate spectral scan message handler * - * This function registers a handler to receive netlink message from - * the spectral scan application process. - * param - - * - None + * This function registers a handler to receive netlink message from + * the spectral scan application process. * * Return - 0 for success, non zero for failure */ int spectral_scan_activate_service(void); /** + * spectral_scan_deactivate_service() - Deactivate spectral scan message handler + * + * This function deregisters a handler to receive netlink message from + * the spectral scan application process. + * + * Return - 0 for success, non zero for failure + */ +int spectral_scan_deactivate_service(void); + +/** * hdd_init_spectral_scan() - Initialize spectral scan config parameters * * This function initialize spectral scan configuration parameters @@ -160,6 +168,11 @@ static inline int spectral_scan_activate_service(void) return 0; } +static inline int spectral_scan_deactivate_service(void) +{ + return 0; +} + static inline void hdd_init_spectral_scan(hdd_context_t *hdd_ctx) { } 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 |
