Re: [PATCH net v1] net: page_pool: fix use-after-free in page_pool_recycle_ring_bulk()
From: Simon Horman
Date: Sat Sep 26 2026 - 13:01:15 EST
On Fri, Sep 25, 2026 at 02:41:11PM +0000, Mina Almasry wrote:
> With CONFIG_PAGE_POOL_STATS=y, page_pool_recycle_ring_bulk() updates
> the recycle stats after dropping the producer lock. If it just recycled
> the last inflight netmems of a pool being destroyed, page_pool_release()
> can pass its producer-lock barrier and free the pool before
> recycle_stat_add() runs.
>
> Commit fcc680a647ba7 ("page_pool: allow mixing PPs within one bulk")
> moved this stat update after the unlock. Commit 271683bb2cf32
> ("page_pool: Fix use-after-free in page_pool_recycle_in_ring") later
> added the barrier, but only fixed page_pool_recycle_in_ring(). Move
> the update back under the lock.
>
> Fixes: fcc680a647ba7 ("page_pool: allow mixing PPs within one bulk")
> Link: https://lore.kernel.org/r/179028939171.2160803.706522228583664641@xxxxxxxxxx
> Cc: Kaifeng Wang <kaifengw@xxxxxxxxxx>
> Cc: Dong Chenchen <dongchenchen2@xxxxxxxxxx>
> Assisted-by: LLM
> Signed-off-by: Mina Almasry <almasrymina@xxxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>