Browse Source

qcacmn: Fix memory leak for SDIO RX path in the HIF layer

qcacld-2.0 to qcacmn propagation

There is a memory leak if fail to process the rx packet header in the HIF
layer. Add sanity checking to free all resources if failure hit.

Change-Id: Ifa443dcec0a31ae39356ac1ddf7cfe652d8968ce
CRs-Fixed: 2137736
Tiger Yu 7 years ago
parent
commit
d448fad508
1 changed files with 10 additions and 2 deletions
  1. 10 2
      hif/src/sdio/hif_sdio_recv.c

+ 10 - 2
hif/src/sdio/hif_sdio_recv.c

@@ -1025,8 +1025,11 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
 				hif_dev_process_recv_header(pdev, packet,
 							    look_aheads,
 							    &num_look_aheads);
-			if (QDF_IS_STATUS_ERROR(status))
+			if (QDF_IS_STATUS_ERROR(status)) {
+				HTC_PACKET_ENQUEUE_TO_HEAD(&sync_completed_pkts_queue,
+					packet);
 				break;
+			}
 
 			netbuf = (qdf_nbuf_t) packet->pNetBufContext;
 			/* set data length */
@@ -1044,8 +1047,13 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
 								pipeid);
 			}
 		}
-		if (QDF_IS_STATUS_ERROR(status))
+
+		if (QDF_IS_STATUS_ERROR(status)) {
+			if (!HTC_QUEUE_EMPTY(&sync_completed_pkts_queue))
+				hif_dev_free_recv_pkt_queue(
+						&sync_completed_pkts_queue);
 			break;
+		}
 
 		if (num_look_aheads == 0) {
 			/* no more look aheads */