From e98cbdec196665a9bdbe914bf3d075087ea12ee5 Mon Sep 17 00:00:00 2001 From: Min Liu Date: Mon, 8 Jan 2018 19:09:15 +0800 Subject: [PATCH] qcacld-3.0: Add NULL pointer check In the following functions, add NULL pointer check to address the following issues: - lim_send_sme_ndp_add_sta_rsp - sme_process_set_hw_mode_resp - sme_update_new_channel_event - sme_change_mcc_beacon_interval - sme_pdev_set_hw_mode - sme_nss_update_request - sme_soc_set_dual_mac_config Change-Id: I55038966474b775fba514591c2657228af4f8769 CRs-Fixed: 2168378 --- core/mac/src/pe/nan/nan_datapath.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/mac/src/pe/nan/nan_datapath.c b/core/mac/src/pe/nan/nan_datapath.c index 207075961b93..084253783b6e 100644 --- a/core/mac/src/pe/nan/nan_datapath.c +++ b/core/mac/src/pe/nan/nan_datapath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -942,13 +942,24 @@ static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx, pe_debug("Invalid add_sta_rsp"); return QDF_STATUS_E_INVAL; } + + if (!psoc) { + pe_debug("Invalid psoc"); + return QDF_STATUS_E_INVAL; + } + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, add_sta_rsp->smesessionId, WLAN_NAN_ID); + if (!vdev) { + pe_debug("Invalid vdev"); + return QDF_STATUS_E_INVAL; + } new_peer_ind = qdf_mem_malloc(sizeof(*new_peer_ind)); if (!new_peer_ind) { pe_debug("Failed to allocate memory"); + wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID); return QDF_STATUS_E_NOMEM; } @@ -959,6 +970,7 @@ static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx, new_peer_ind->sta_id = add_sta_rsp->staIdx; ucfg_nan_event_handler(psoc, vdev, NDP_NEW_PEER, new_peer_ind); + wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID); return QDF_STATUS_SUCCESS; } #endif