Re: [PATCH net] net: mscc: ocelot: Fix use-after-free caused by cyclic delayed work
From: Paolo Abeni
Date: Tue Sep 30 2025 - 07:13:54 EST
On 9/27/25 4:45 PM, Duoming Zhou wrote:
> diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c
> index 545710dadcf5..d8ab789f6bea 100644
> --- a/drivers/net/ethernet/mscc/ocelot_stats.c
> +++ b/drivers/net/ethernet/mscc/ocelot_stats.c
> @@ -1021,6 +1021,6 @@ int ocelot_stats_init(struct ocelot *ocelot)
>
> void ocelot_stats_deinit(struct ocelot *ocelot)
> {
> - cancel_delayed_work(&ocelot->stats_work);
> + cancel_delayed_work_sync(&ocelot->stats_work);
> destroy_workqueue(ocelot->stats_queue);
> }
AFAICS the stat_work can unconditionally reschedule itself, you should
use disable_delayed_work_sync() instead.
Cheers,
Paolo