Skip to content

Commit 9298501

Browse files
krish2718dkalowsk
authored andcommitted
drivers: nrfwifi: Fix memory leak in TX path
During secure association, if we get any data packets from the networking stack (as we switch off the dormancy) then they will be dropped till the 802.1x port is authorized, but with recent changes the corresponding network buffer isn't freed causing a memory leak. Handle this case and free the network buffer (Using an OSAL API though it's Zephyr to avoid duplication and also getting access to "struct nwb"); Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 83c3b1c commit 9298501

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/wifi/nrfwifi/src/net_if.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ int nrf_wifi_if_send(const struct device *dev,
389389
#ifdef CONFIG_NRF70_RAW_DATA_TX
390390
if ((*(unsigned int *)pkt->frags->data) == NRF_WIFI_MAGIC_NUM_RAWTX) {
391391
if (vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) {
392-
goto unlock;
392+
goto drop;
393393
}
394394

395395
ret = nrf_wifi_fmac_start_rawpkt_xmit(rpu_ctx_zep->rpu_ctx,
@@ -399,7 +399,7 @@ int nrf_wifi_if_send(const struct device *dev,
399399
#endif /* CONFIG_NRF70_RAW_DATA_TX */
400400
if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) ||
401401
(!vif_ctx_zep->authorized && !is_eapol(pkt))) {
402-
goto unlock;
402+
goto drop;
403403
}
404404

405405
ret = nrf_wifi_fmac_start_xmit(rpu_ctx_zep->rpu_ctx,
@@ -408,6 +408,10 @@ int nrf_wifi_if_send(const struct device *dev,
408408
#ifdef CONFIG_NRF70_RAW_DATA_TX
409409
}
410410
#endif /* CONFIG_NRF70_RAW_DATA_TX */
411+
goto unlock;
412+
drop:
413+
host_stats->total_tx_drop_pkts++;
414+
nrf_wifi_osal_nbuf_free(nbuf);
411415
unlock:
412416
k_mutex_unlock(&vif_ctx_zep->vif_lock);
413417
#else

0 commit comments

Comments
 (0)