Эх сурвалжийг харах

qcacld-3.0: Put the htc pkt in freelist on htc_send_pkt failure

In case of nbuf map failure as part of htc_send_pkt for
tx credit flow disabled endpoints, htc pkt is not put
back in the freelist as return status is not checked
resulting in memory leak.

Fix is to put the htc pkt back in the freelist based on
status returned by htc_send_pkt.

Change-Id: I9173fa3684bc887a360b92d48b689c53a5ad5dbe
CRs-Fixed: 2593729
Yeshwanth Sriram Guntuka 5 жил өмнө
parent
commit
872ba80018
1 өөрчлөгдсөн 27 нэмэгдсэн , 6 устгасан
  1. 27 6
      core/dp/htt/htt_h2t.c

+ 27 - 6
core/dp/htt/htt_h2t.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -59,8 +59,13 @@
 #ifdef ATH_11AC_TXCOMPACT
 #define HTT_SEND_HTC_PKT(pdev, pkt)                              \
 do {                                                             \
-	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS) \
+	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) ==       \
+	    QDF_STATUS_SUCCESS) {                                \
 		htt_htc_misc_pkt_list_add(pdev, pkt);            \
+	} else {                                                 \
+		qdf_nbuf_free((qdf_nbuf_t)(pkt->htc_pkt.pNetBufContext));   \
+		htt_htc_pkt_free(pdev, pkt);                     \
+	}                                                        \
 } while (0)
 #else
 #define HTT_SEND_HTC_PKT(pdev, ppkt) \
@@ -214,8 +219,12 @@ QDF_STATUS htt_h2t_frag_desc_bank_cfg_msg(struct htt_pdev_t *pdev)
 
 	rc = htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
 #ifdef ATH_11AC_TXCOMPACT
-	if (rc == QDF_STATUS_SUCCESS)
+	if (rc == QDF_STATUS_SUCCESS) {
 		htt_htc_misc_pkt_list_add(pdev, pkt);
+	} else {
+		qdf_nbuf_free(msg);
+		htt_htc_pkt_free(pdev, pkt);
+	}
 #endif
 
 	return rc;
@@ -741,8 +750,12 @@ htt_h2t_rx_ring_cfg_msg_hl(struct htt_pdev_t *pdev)
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
 
 #ifdef ATH_11AC_TXCOMPACT
-	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS)
+	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS) {
 		htt_htc_misc_pkt_list_add(pdev, pkt);
+	} else {
+		qdf_nbuf_free(msg);
+		htt_htc_pkt_free(pdev, pkt);
+	}
 #else
 	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
 #endif
@@ -850,8 +863,12 @@ htt_h2t_dbg_stats_get(struct htt_pdev_t *pdev,
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
 
 #ifdef ATH_11AC_TXCOMPACT
-	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS)
+	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS) {
 		htt_htc_misc_pkt_list_add(pdev, pkt);
+	} else {
+		qdf_nbuf_free(msg);
+		htt_htc_pkt_free(pdev, pkt);
+	}
 #else
 	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
 #endif
@@ -971,8 +988,12 @@ htt_h2t_aggr_cfg_msg(struct htt_pdev_t *pdev,
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
 
 #ifdef ATH_11AC_TXCOMPACT
-	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS)
+	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS) {
 		htt_htc_misc_pkt_list_add(pdev, pkt);
+	} else {
+		qdf_nbuf_free(msg);
+		htt_htc_pkt_free(pdev, pkt);
+	}
 #else
 	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
 #endif