qcacmn: Add SSR protection to os_if_wifi_pos_callback()

Protect SSR protection for wifi pos callback function to prevent
possible race condition between user request and driver unload.

Change-Id: I68d3636429f8891f0a4d6c78642aeecf7d67e105
CRs-Fixed: 2349354
This commit is contained in:
Arif Hussain
2019-03-12 11:38:49 -07:00
committed by nshrivas
parent f3ed004380
commit 2fcbb3f715
2 changed files with 33 additions and 4 deletions

View File

@@ -22,6 +22,7 @@
* component's os_if layer.
*/
#include "qdf_platform.h"
#include "wlan_nlink_srv.h"
#include "wlan_ptt_sock_svc.h"
#include "wlan_nlink_common.h"
@@ -149,15 +150,15 @@ static int wifi_pos_parse_req(struct sk_buff *skb, struct wifi_pos_req_msg *req)
#endif
/**
* os_if_wifi_pos_callback() - callback registered with NL service socket to
* __os_if_wifi_pos_callback() - callback registered with NL service socket to
* process wifi pos request
* @skb: request message sk_buff
*
* Return: status of operation
*/
#ifdef CNSS_GENL
static void os_if_wifi_pos_callback(const void *data, int data_len,
void *ctx, int pid)
static void __os_if_wifi_pos_callback(const void *data, int data_len,
void *ctx, int pid)
{
uint8_t err;
QDF_STATUS status;
@@ -187,8 +188,20 @@ static void os_if_wifi_pos_callback(const void *data, int data_len,
release_psoc_ref:
wlan_objmgr_psoc_release_ref(psoc, WLAN_WIFI_POS_OSIF_ID);
}
static void os_if_wifi_pos_callback(const void *data, int data_len,
void *ctx, int pid)
{
struct qdf_op_sync *op_sync;
if (qdf_op_protect(&op_sync))
return;
__os_if_wifi_pos_callback(data, data_len, ctx, pid);
qdf_op_unprotect(op_sync);
}
#else
static int os_if_wifi_pos_callback(struct sk_buff *skb)
static int __os_if_wifi_pos_callback(struct sk_buff *skb)
{
uint8_t err;
QDF_STATUS status;
@@ -220,6 +233,20 @@ release_psoc_ref:
return qdf_status_to_os_return(status);
}
static int os_if_wifi_pos_callback(struct sk_buff *skb)
{
struct qdf_op_sync *op_sync;
int err;
if (qdf_op_protect(&op_sync))
return -EINVAL;
err = __os_if_wifi_pos_callback(skb);
qdf_op_unprotect(op_sync);
return err;
}
#endif
#ifdef CNSS_GENL

View File

@@ -24,6 +24,8 @@
#ifndef _QDF_PLATFORM_H
#define _QDF_PLATFORM_H
#include "qdf_types.h"
/**
* qdf_self_recovery_callback() - callback for self recovery
* @reason: the reason for the recovery request