summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Rawat <nrawat@qca.qualcomm.com>2016-07-12 10:12:14 -0700
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-07-18 11:52:52 +0530
commitae7eff2e6957ab1ea22114c339b594b5898cc24d (patch)
treea2046db9b9334eed64bcd64cffd1ceb77a43c7f5
parentf76b68a4a745928b8a4ac0a7bdf7b93801b87119 (diff)
qcacld-2.0: Fix null pointer dereference in wlan_hdd_nan_datapath.c
This is qcacld-3.0 to qcacld-2.0 propagation. Fix null pointer dereference in wlan_hdd_nan_datapath.c Change-Id: Ic968e441411033c3eeb9ec39aff4fc308b80bce8 CRs-Fixed: 962367
-rw-r--r--CORE/HDD/src/wlan_hdd_nan_datapath.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/CORE/HDD/src/wlan_hdd_nan_datapath.c b/CORE/HDD/src/wlan_hdd_nan_datapath.c
index fc1d45d82f7c..135d3bcec063 100644
--- a/CORE/HDD/src/wlan_hdd_nan_datapath.c
+++ b/CORE/HDD/src/wlan_hdd_nan_datapath.c
@@ -760,7 +760,8 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
bool create_fail = false;
uint8_t create_transaction_id = 0;
- uint32_t create_status = 0;
+ uint32_t create_status = NDP_RSP_STATUS_ERROR;
+ uint32_t create_reason = NDP_NAN_DATA_IFACE_CREATE_FAILED;
ENTER();
@@ -770,6 +771,7 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
if (ndi_rsp) {
create_status = ndi_rsp->status;
+ create_reason = ndi_rsp->reason;
} else {
hddLog(LOGE, FL("Invalid ndi create response"));
create_fail = true;
@@ -819,7 +821,7 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
/* Status return value */
if (nla_put_u32(vendor_event,
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
- ndi_rsp->reason)) {
+ create_reason)) {
hddLog(LOGE, FL("VENDOR_ATTR_NDP_DRV_RETURN_VALUE put fail"));
goto nla_put_failure;
}
@@ -834,7 +836,7 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE, create_status);
hddLog(LOG2, FL("Return value: %d, value: %d"),
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
- ndi_rsp->reason);
+ create_reason);
cfg80211_vendor_event(vendor_event, GFP_KERNEL);
@@ -848,7 +850,7 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
} else {
hddLog(LOGE,
FL("NDI interface creation failed with reason %d"),
- ndi_rsp->reason);
+ create_reason);
}
/* Something went wrong while starting the BSS */
@@ -1626,6 +1628,7 @@ static void hdd_ndp_end_ind_handler(hdd_adapter_t *adapter,
struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
uint32_t *ndp_instance_array;
+ hdd_adapter_t *ndi_adapter;
ENTER();
@@ -1647,9 +1650,14 @@ static void hdd_ndp_end_ind_handler(hdd_adapter_t *adapter,
int idx;
ndp_instance_array[i] = end_ind->ndp_map[i].ndp_instance_id;
- ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(
- hdd_get_adapter_by_vdev(hdd_ctx,
- end_ind->ndp_map[i].vdev_id));
+ ndi_adapter = hdd_get_adapter_by_vdev(hdd_ctx,
+ end_ind->ndp_map[i].vdev_id);
+ if (ndi_adapter == NULL) {
+ hddLog(LOGE, FL("Adapter not found for vdev_id: %d"),
+ end_ind->ndp_map[i].vdev_id);
+ continue;
+ }
+ ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(ndi_adapter);
idx = hdd_get_peer_idx(sta_ctx,
&end_ind->ndp_map[i].peer_ndi_mac_addr);
if (idx == INVALID_PEER_IDX) {