Re: [PATCH 2/4] extcon: extcon-max14577: Fix potential work-queue cancellation race

From: Krzysztof Kozlowski
Date: Mon May 10 2021 - 10:16:31 EST


On 10/05/2021 04:11, Matti Vaittinen wrote:
> The extcon IRQ schedules a work item. IRQ is requested using devm while
> WQ is cancelld at remove(). This mixing of devm and manual unwinding has
> potential case where the WQ has been emptied (.remove() was ran) but
> devm unwinding of IRQ was not yet done. It is possible the IRQ is triggered
> at this point scheduling new work item to the already flushed queue.
>
> Use new devm_work_autocancel() to remove the remove() and to kill the bug.
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx>
> ---
>
> Please note that the change is compile-tested only. All proper testing is
> highly appreciated.
> ---
> drivers/extcon/extcon-max14577.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>

I don't have the HW anymore for this testing, but looks good:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxx>


Best regards,
Krzysztof