qcacmn: Deregister NL MSG handlers during hdd_wlan_exit

Currently the NL MSG handlers for 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: I231e2f32e708e9a14305f0a8f9f2f603aa42b031
CRs-Fixed: 2243993
This commit is contained in:
Vignesh Viswanathan
2018-05-17 21:22:49 +05:30
committed by nshrivas
parent 2318e0f0e7
commit 4c9e971f8e
4 changed files with 82 additions and 59 deletions

View File

@@ -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,29 +4280,33 @@ 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;
}
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;
}
return 0;
}
#endif

View File

@@ -164,9 +164,26 @@ int
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);
#else
static inline int
dbglog_parser_type_init(wmi_unified_t wmi_handle, int type)
@@ -205,6 +222,11 @@ static inline int cnss_diag_activate_service(void)
return A_OK;
}
static inline int cnss_diag_deactivate_service(void)
{
return A_OK;
}
static inline int
dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
A_BOOL isenable)

View File

@@ -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,33 @@
* 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)
{

View File

@@ -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
@@ -316,52 +316,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