esp_netif: retain RX pbuf free callback (IDFGH-17719)#18656
Open
dhimasardinata wants to merge 2 commits into
Open
esp_netif: retain RX pbuf free callback (IDFGH-17719)#18656dhimasardinata wants to merge 2 commits into
dhimasardinata wants to merge 2 commits into
Conversation
Store the driver RX-buffer free callback and driver handle inside each custom pbuf at allocation time. This keeps delayed pbuf_free() independent from later esp_netif driver config teardown. Add an esp_netif regression test that clears the driver config before freeing a custom pbuf.
TD-er
reviewed
May 27, 2026
TD-er
reviewed
May 27, 2026
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pbuf_free()independent from lateresp_netifdriver config teardown.esp_netifregression test that clears the driver config before freeing the custom pbuf.Root cause
esp_pbuf_allocate()kept anesp_netif_t *inside the custom pbuf. If the netif driver config was cleared before a queued pbuf was drained,esp_pbuf_free()could later call through the cleared/staleesp_netif->driver_free_rx_bufferpath.Verification
git diff --checkidf.py -C examples/wifi/getting_started/station -B /tmp/espnetif_pbuf_station_build -D SDKCONFIG=/tmp/espnetif_pbuf_station_sdkconfig set-target esp32 buildidf.py -C components/esp_netif/test_apps/test_app_esp_netif -B /tmp/espnetif_test_app_build -D SDKCONFIG=/tmp/espnetif_test_app_sdkconfig set-target esp32 buildRefs espressif/arduino-esp32#12517