Re: [PATCH net] net/wan/hdlc_ppp: sync per-proto timers before freeing hdlc state
From: patchwork-bot+netdevbpf@kernel.org
Date: 2026-06-23 01:30:22
Also in:
lkml, stable
From: patchwork-bot+netdevbpf@kernel.org
Date: 2026-06-23 01:30:22
Also in:
lkml, stable
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski [off-list ref]: On Wed, 17 Jun 2026 02:05:18 +0000 you wrote:
Each PPP control protocol (LCP/IPCP/IPV6CP) embedded in struct ppp registers a timer via timer_setup(). That struct ppp is the hdlc->state allocation, which detach_hdlc_protocol() frees with kfree() in both teardown paths: unregister_hdlc_device() and the re-attach inside attach_hdlc_protocol(). The ppp proto never registered a .detach callback, so detach_hdlc_protocol() performs no timer synchronization before the kfree(). The only cancel, timer_delete(&proto->timer) in ppp_cp_event(), is partial (it does not wait for a running callback) and only runs on the ->CLOSED transition; ppp_stop()/ppp_close() do not sync either. A ppp_timer callback already executing (blocked on ppp->lock) survives the kfree and then dereferences proto->state / ppp->lock in freed memory, leading to a use-after-free. [...]
Here is the summary with links:
- [net] net/wan/hdlc_ppp: sync per-proto timers before freeing hdlc state
https://git.kernel.org/netdev/net/c/c78a4e41ab5e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html