qcacmn: Check whether Spectral is disabled upon setting rxchainmask

When Spectral is disabled via INI and the rxchainmask is set for
the radio via iwpriv/cfg80211tool, it results in null pointer access
of target_if_spectral pointer. To fix this, add Spectral feature check
inside target_if_spectral_set_rxchainmask.

Change-Id: Ibd43d3bbc8622d4b8502653b55511bb4667cec7a
CRs-Fixed: 2380653
This commit is contained in:
Shiva Krishna Pittala
2019-01-14 18:32:13 +05:30
committed by nshrivas
parent 7dd1429dab
commit 66ae9bef51
3 changed files with 21 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -182,6 +182,8 @@ wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
sptrl_rx_ops->sptrlro_vdev_get_ch_width = spectral_vdev_get_ch_width;
sptrl_rx_ops->sptrlro_vdev_get_sec20chan_freq_mhz =
spectral_vdev_get_sec20chan_freq_mhz;
sptrl_rx_ops->sptrlro_spectral_is_feature_disabled =
wlan_spectral_is_feature_disabled;
}
void

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011,2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011,2017-2019 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -1312,8 +1312,21 @@ static inline
void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev,
uint8_t spectral_rx_chainmask)
{
struct wlan_objmgr_psoc *psoc = NULL;
struct target_if_spectral *spectral = NULL;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
spectral_err("psoc is NULL");
return;
}
if (psoc->soc_cb.rx_ops.sptrl_rx_ops.
sptrlro_spectral_is_feature_disabled(psoc)) {
spectral_info("Spectral is disabled");
return;
}
spectral = get_target_if_spectral_handle_from_pdev(pdev);
spectral->params.ss_chn_mask = spectral_rx_chainmask;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -1019,6 +1019,7 @@ struct wlan_lmac_if_sa_api_rx_ops {
* struct wlan_lmac_if_sptrl_rx_ops - Spectral south bound Rx operations
*
* @sptrlro_get_target_handle: Get Spectral handle for target/LMAC private data
* @sptrlro_spectral_is_feature_disabled: Check if spectral feature is disabled
*/
struct wlan_lmac_if_sptrl_rx_ops {
void * (*sptrlro_get_target_handle)(struct wlan_objmgr_pdev *pdev);
@@ -1028,6 +1029,8 @@ struct wlan_lmac_if_sptrl_rx_ops {
int (*sptrlro_vdev_get_sec20chan_freq_mhz)(
struct wlan_objmgr_vdev *vdev,
uint16_t *sec20chan_freq);
bool (*sptrlro_spectral_is_feature_disabled)(
struct wlan_objmgr_psoc *psoc);
};
#endif /* WLAN_CONV_SPECTRAL_ENABLE */