Quellcode durchsuchen

qcacmn: Fix memleak issue

Fix memleak issue from pktlog

Change-Id: I4665ce3891c94142aa27349f13669340036b6f98
CRs-Fixed: 3129139
Amir Patel vor 3 Jahren
Ursprung
Commit
e9abac8dc3

+ 8 - 5
dp/wifi3.0/monitor/2.0/dp_rx_mon_2.0.c

@@ -45,6 +45,7 @@ dp_rx_mon_srng_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx,
 	union dp_mon_desc_list_elem_t *desc_list = NULL;
 	union dp_mon_desc_list_elem_t *tail = NULL;
 	struct dp_mon_desc_pool *rx_mon_desc_pool = &mon_soc_be->rx_desc_mon;
+	QDF_STATUS status;
 
 	if (!pdev) {
 		dp_mon_err("%pK: pdev is null for mac_id = %d", soc, mac_id);
@@ -95,15 +96,17 @@ dp_rx_mon_srng_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx,
 			mon_desc->unmapped = 1;
 		}
 
-		dp_rx_process_pktlog_be(soc, pdev, ppdu_info,
-					mon_desc->buf_addr,
-					hal_mon_rx_desc.end_offset);
-
 		dp_rx_mon_process_status_tlv(soc, pdev,
 					     &hal_mon_rx_desc,
 					     mon_desc->paddr);
 
-		qdf_frag_free(mon_desc->buf_addr);
+		status = dp_rx_process_pktlog_be(soc, pdev, ppdu_info,
+						 mon_desc->buf_addr,
+						 hal_mon_rx_desc.end_offset);
+
+		if (status != QDF_STATUS_SUCCESS)
+			qdf_frag_free(mon_desc->buf_addr);
+
 		dp_mon_add_to_free_desc_list(&desc_list, &tail, mon_desc);
 		work_done++;
 		hal_srng_dst_get_next(hal_soc, mon_dst_srng);

+ 4 - 4
dp/wifi3.0/monitor/2.0/dp_rx_mon_2.0.h

@@ -132,11 +132,11 @@ dp_rx_mon_populate_ppdu_info_2_0(struct hal_rx_ppdu_info *hal_ppdu_info,
  * @status_frag: frag pointer which needs to be added to nbuf
  * @end_offset: Offset in frag to be added to nbuf_frags
  *
- * Return: void
+ * Return: SUCCESS or Failure
  */
-void dp_rx_process_pktlog_be(struct dp_soc *soc, struct dp_pdev *pdev,
-			     struct hal_rx_ppdu_info *ppdu_info,
-			     void *status_frag, uint32_t end_offset);
+QDF_STATUS dp_rx_process_pktlog_be(struct dp_soc *soc, struct dp_pdev *pdev,
+				   struct hal_rx_ppdu_info *ppdu_info,
+				   void *status_frag, uint32_t end_offset);
 
 #if !defined(DISABLE_MON_CONFIG)
 /*

+ 7 - 4
dp/wifi3.0/monitor/2.0/dp_rx_mon_status_2.0.c

@@ -34,7 +34,7 @@ void dp_rx_mon_process_status_tlv(struct dp_soc *soc,
 	/* API to process status tlv */
 }
 
-void
+QDF_STATUS
 dp_rx_process_pktlog_be(struct dp_soc *soc, struct dp_pdev *pdev,
 			struct hal_rx_ppdu_info *ppdu_info,
 			void *status_frag, uint32_t end_offset)
@@ -44,14 +44,14 @@ dp_rx_process_pktlog_be(struct dp_soc *soc, struct dp_pdev *pdev,
 	enum WDI_EVENT pktlog_mode = WDI_NO_VAL;
 
 	if (mon_pdev->dp_peer_based_pktlog &&
-	    (mon_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED)) {
-		return;
+	    (mon_pdev->rx_pktlog_mode == DP_RX_PKTLOG_DISABLED)) {
+		return QDF_STATUS_E_INVAL;
 	}
 
 	nbuf = qdf_nbuf_alloc(soc->osdev, RX_MON_MIN_HEAD_ROOM,
 			      RX_BUFFER_RESERVATION, 0, FALSE);
 	if (!nbuf)
-		return;
+		return QDF_STATUS_E_NOMEM;
 
 	qdf_nbuf_add_rx_frag(status_frag, nbuf, 0,
 			     end_offset,
@@ -71,5 +71,8 @@ dp_rx_process_pktlog_be(struct dp_soc *soc, struct dp_pdev *pdev,
 					     nbuf, HTT_INVALID_PEER,
 					     WDI_NO_VAL, pdev->pdev_id);
 	}
+	qdf_nbuf_free(nbuf);
+
+	return QDF_STATUS_SUCCESS;
 }