Re: [PATCH net-next] net: kcm: Fix race condition in kcm_unattach()

From: Sven Stegemann
Date: Tue Aug 12 2025 - 15:30:01 EST


On 8/12/2025 2:54 PM, Paolo Abeni wrote:
> On 8/9/25 8:36 AM, Sven Stegemann wrote:
>> @@ -1714,6 +1708,7 @@ static int kcm_release(struct socket *sock)
>> /* Cancel work. After this point there should be no outside references
>> * to the kcm socket.
>> */
>> + disable_work(&kcm->tx_work);
>> cancel_work_sync(&kcm->tx_work);
>
> The patch looks functionally correct, but I guess it would be cleaner
> simply replacing:
>
> cancel_work_sync(&kcm->tx_work);
>
> with:
>
> disable_work_sync(&kcm->tx_work);

Thank you, that's a good point.

I just submitted a cleaned up version of the patch.