diff options
author | Daniël van de Giessen <daniel@dvdgiessen.nl> | 2025-07-08 15:52:17 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-08-11 12:38:37 +1000 |
commit | 8c47ff7153a7a54eced6c8177698339abe4973ae (patch) | |
tree | 80cbd16174073679f7fef986fe9cf1fdf685959d /esp8266/modpybadc.c | |
parent | adcfdf625be4ce1a8506dccc33ea60ab5d84ab46 (diff) |
esp32/network_ppp: Correctly clean up PPP PCB after close.
If PPP is still connected, freeing the PCB will fail and thus instead we
should trigger a disconnect and wait for the lwIP callback to actually
free the PCB.
When PPP is not connected we should check if the freeing failed, warn
the user if so, and only mark the connection as inactive if not.
When all this happens during garbage collection the best case is that
the PPP connection is already dead, which means the callback will be
called immediately and cleanup will happen correctly. The worst case is
that the connection is still alive, thus we are unable to free the PCB
(lwIP won't let us) and it remains referenced in the netif_list, meaning
a use-after-free happens later when lwIP traverses that linked list.
This change does not fully prevent that, but it *does* improve how the
PPP.active(False) method on the ESP32 port behaves: It no longer
immediately tries to free (and fails), but instead triggers a disconnect
and lets the cleanup happen correctly through the status callback.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Diffstat (limited to 'esp8266/modpybadc.c')
0 files changed, 0 insertions, 0 deletions