Browse Source

qcacld-3.0: Add Null pointer check for packet buffer

Add Null pointer check for packet buffer before dereference
it in lim_send_addba_response_frame() API.

Change-Id: I46c637b7534fe200ec586b07e34d9a4baee5ac7e
CRs-Fixed: 2232740
Sandeep Puligilla 7 years ago
parent
commit
39cec0833b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      core/mac/src/pe/lim/lim_send_management_frames.c

+ 2 - 2
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -4737,7 +4737,7 @@ QDF_STATUS lim_send_addba_response_frame(tpAniSirGlobal mac_ctx,
 	uint8_t *frame_ptr;
 	tpSirMacMgmtHdr mgmt_hdr;
 	uint32_t num_bytes, payload_size, status;
-	void *pkt_ptr;
+	void *pkt_ptr = NULL;
 	QDF_STATUS qdf_status;
 	uint8_t tx_flag = 0;
 	uint8_t sme_sessionid = 0;
@@ -4820,7 +4820,7 @@ QDF_STATUS lim_send_addba_response_frame(tpAniSirGlobal mac_ctx,
 	num_bytes = payload_size + sizeof(*mgmt_hdr);
 	qdf_status = cds_packet_alloc(num_bytes, (void **)&frame_ptr,
 				      (void **)&pkt_ptr);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
+	if (!QDF_IS_STATUS_SUCCESS(qdf_status) || (!pkt_ptr)) {
 		pe_err("Failed to allocate %d bytes for a ADDBA response action frame",
 			num_bytes);
 		return QDF_STATUS_E_FAILURE;