qcacld-3.0: Check NULL value of hdd_adapter_get_mac_handle()
The return of hdd_adapter_get_mac_handle() API can be NULL. Check the NULL pointer before accessing. Change-Id: Iad0c6be8932323442bc0080ea311092207bf32e6 CRs-Fixed: 3463354
This commit is contained in:

committed by
Madan Koyyalamudi

parent
f40f4779ff
commit
ed66985f0d
@@ -495,6 +495,13 @@ static int hdd_apf_read_memory(struct hdd_adapter *adapter, struct nlattr **tb)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct sk_buff *skb = NULL;
|
struct sk_buff *skb = NULL;
|
||||||
uint8_t *bufptr;
|
uint8_t *bufptr;
|
||||||
|
mac_handle_t mac_handle;
|
||||||
|
|
||||||
|
mac_handle = hdd_adapter_get_mac_handle(adapter);
|
||||||
|
if (!mac_handle) {
|
||||||
|
hdd_debug("mac ctx NULL");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (context->apf_enabled) {
|
if (context->apf_enabled) {
|
||||||
hdd_err("Cannot get/set while interpreter is enabled");
|
hdd_err("Cannot get/set while interpreter is enabled");
|
||||||
@@ -536,8 +543,7 @@ static int hdd_apf_read_memory(struct hdd_adapter *adapter, struct nlattr **tb)
|
|||||||
context->buf_len = read_mem_params.length;
|
context->buf_len = read_mem_params.length;
|
||||||
context->magic = APF_CONTEXT_MAGIC;
|
context->magic = APF_CONTEXT_MAGIC;
|
||||||
|
|
||||||
status = sme_apf_read_work_memory(hdd_adapter_get_mac_handle(adapter),
|
status = sme_apf_read_work_memory(mac_handle, &read_mem_params,
|
||||||
&read_mem_params,
|
|
||||||
hdd_apf_read_memory_callback);
|
hdd_apf_read_memory_callback);
|
||||||
if (QDF_IS_STATUS_ERROR(status)) {
|
if (QDF_IS_STATUS_ERROR(status)) {
|
||||||
hdd_err("Unable to post sme APF read memory message (status-%d)",
|
hdd_err("Unable to post sme APF read memory message (status-%d)",
|
||||||
|
@@ -2137,12 +2137,16 @@ static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter,
|
|||||||
struct hdd_chan_change_params chan_change;
|
struct hdd_chan_change_params chan_change;
|
||||||
QDF_STATUS status;
|
QDF_STATUS status;
|
||||||
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||||
mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter);
|
mac_handle_t mac_handle;
|
||||||
struct hdd_station_ctx *sta_ctx;
|
struct hdd_station_ctx *sta_ctx;
|
||||||
uint8_t connected_vdev;
|
uint8_t connected_vdev;
|
||||||
bool notify = true, is_sap_go_moved_before_sta = false;
|
bool notify = true, is_sap_go_moved_before_sta = false;
|
||||||
struct wlan_objmgr_vdev *vdev;
|
struct wlan_objmgr_vdev *vdev;
|
||||||
|
|
||||||
|
mac_handle = hdd_adapter_get_mac_handle(adapter);
|
||||||
|
if (!mac_handle)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Enable Roaming on STA interface which was disabled before CSA */
|
/* Enable Roaming on STA interface which was disabled before CSA */
|
||||||
if (adapter->device_mode == QDF_STA_MODE)
|
if (adapter->device_mode == QDF_STA_MODE)
|
||||||
sme_start_roaming(mac_handle, adapter->deflink->vdev_id,
|
sme_start_roaming(mac_handle, adapter->deflink->vdev_id,
|
||||||
|
@@ -19767,6 +19767,11 @@ int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid,
|
|||||||
mac_handle_t mac_handle;
|
mac_handle_t mac_handle;
|
||||||
|
|
||||||
mac_handle = hdd_adapter_get_mac_handle(adapter);
|
mac_handle = hdd_adapter_get_mac_handle(adapter);
|
||||||
|
if (!mac_handle) {
|
||||||
|
hdd_err("mac context NULL");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
status = sme_get_rssi_snr_by_bssid(mac_handle, bssid, rssi, snr);
|
status = sme_get_rssi_snr_by_bssid(mac_handle, bssid, rssi, snr);
|
||||||
if (QDF_STATUS_SUCCESS != status) {
|
if (QDF_STATUS_SUCCESS != status) {
|
||||||
hdd_debug("sme_get_rssi_snr_by_bssid failed");
|
hdd_debug("sme_get_rssi_snr_by_bssid failed");
|
||||||
|
@@ -306,6 +306,11 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter)
|
|||||||
hdd_enter();
|
hdd_enter();
|
||||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||||
|
|
||||||
|
if (!mac) {
|
||||||
|
hdd_debug("mac ctx NULL");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
status = hdd_ndi_select_valid_freq(hdd_ctx, &valid_freq);
|
status = hdd_ndi_select_valid_freq(hdd_ctx, &valid_freq);
|
||||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||||
hdd_err("Unable to retrieve channel list for NAN");
|
hdd_err("Unable to retrieve channel list for NAN");
|
||||||
|
Reference in New Issue
Block a user