Re: [PATCH v2] staging: most: video: fix potential race in list iteration
From: Dan Carpenter
Date: Thu Feb 05 2026 - 00:45:32 EST
On Thu, Feb 05, 2026 at 11:16:20AM +0900, Minu Jin wrote:
> There is a pattern in the loops where the lock is dropped
> to call a specific function and then re-acquired.
>
> The list can be exposed during this short gap, creating a potential
> race condition. This patch fixes the problem by replacing the list
> head with a local free list using list_replace_init(), instead of
> using the lock/unlock pattern in the loop.
>
> Signed-off-by: Minu Jin <s9430939@xxxxxxxxx>
> ---
> Changes in v2:
> - Use list_replace_init() instead of moving one-by-one.
> (suggested by Dan Carpenter)
Thanks.
Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
regards,
dan carpenter