Browse Source

qcacld-3.0: Fix vdev reference count in packet capture

In pkt_capture_datapkt_process and pkt_capture_mgmt_rx_data_cb
pkt_capture_vdev_put_ref is missing in error case, because of
which vdev ref count is not becoming zero when vdev is down.

Add pkt_capture_vdev_put_ref in all the error cases.

Change-Id: I55353356f059a367d57c64625f404e3940235be1
CRs-Fixed: 3228599
Vulupala Shashank Reddy 2 years ago
parent
commit
487a76179b

+ 8 - 5
components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c

@@ -1471,10 +1471,6 @@ void pkt_capture_datapkt_process(
 	if (QDF_IS_STATUS_ERROR(ret))
 		goto drop_rx_buf;
 
-	pkt = pkt_capture_alloc_mon_pkt(vdev);
-	if (!pkt)
-		goto drop_rx_buf;
-
 	switch (type) {
 	case TXRX_PROCESS_TYPE_DATA_RX:
 		callback = pkt_capture_rx_data_cb;
@@ -1484,7 +1480,14 @@ void pkt_capture_datapkt_process(
 		callback = pkt_capture_tx_data_cb;
 		break;
 	default:
-		return;
+		pkt_capture_vdev_put_ref(vdev);
+		goto drop_rx_buf;
+	}
+
+	pkt = pkt_capture_alloc_mon_pkt(vdev);
+	if (!pkt) {
+		pkt_capture_vdev_put_ref(vdev);
+		goto drop_rx_buf;
 	}
 
 	pkt->callback = callback;

+ 1 - 0
components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c

@@ -594,6 +594,7 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
 				  buf_len + RESERVE_BYTES, 4),
 				  RESERVE_BYTES, 4, false);
 	if (!nbuf) {
+		pkt_capture_vdev_put_ref(vdev);
 		qdf_nbuf_free(wbuf);
 		return QDF_STATUS_E_FAILURE;
 	}