Skip to content

Commit

Permalink
[nrf fromlist] drivers: nrfwifi: Fix memory leak in TX path
Browse files Browse the repository at this point in the history
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");

Upstream PR #: 80528

Signed-off-by: Chaitanya Tata <[email protected]>
(cherry picked from commit 979a672)
  • Loading branch information
krish2718 authored and github-actions[bot] committed Oct 30, 2024
1 parent c6d8f5d commit 58451f5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/wifi/nrfwifi/src/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ int nrf_wifi_if_send(const struct device *dev,
#ifdef CONFIG_NRF70_RAW_DATA_TX
if ((*(unsigned int *)pkt->frags->data) == NRF_WIFI_MAGIC_NUM_RAWTX) {
if (vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) {
goto unlock;
goto drop;
}

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

ret = nrf_wifi_fmac_start_xmit(rpu_ctx_zep->rpu_ctx,
Expand All @@ -408,6 +408,10 @@ int nrf_wifi_if_send(const struct device *dev,
#ifdef CONFIG_NRF70_RAW_DATA_TX
}
#endif /* CONFIG_NRF70_RAW_DATA_TX */
goto unlock;
drop:
host_stats->total_tx_drop_pkts++;
nrf_wifi_osal_nbuf_free(nbuf);
unlock:
k_mutex_unlock(&vif_ctx_zep->vif_lock);
#else
Expand Down

0 comments on commit 58451f5

Please sign in to comment.