Re: [PATCH v6] loop: Fix NULL pointer dereference in lo_rw_aio()
From: Tetsuo Handa
Date: Tue Aug 25 2026 - 19:29:47 EST
On 2026/08/26 7:18, Bart Van Assche wrote:
>> you also recognized that we can't call drain_workqueue() or flush_workqueue().
>>
>> Therefore, I chose to temporarily drop lo->lo_disk->open_mutex in order to
>> make it possible to safely perform drain_workqueue().
>
> There is another possibility: set QUEUE_FLAG_DYING in __loop_clr_fd() before modifying queue limits and clear it again after modifying queue
> limits has finished. Feedback on the patch below is welcome.
>
See https://lkml.kernel.org/r/26717cb6-81b0-4d5d-a5db-669283f9bb9d@xxxxxxxxxxxxxxxxxxx .
> + /* Wait until all I/O-related work has finished. */
> + flush_workqueue(lo->workqueue);
I don't know about QUEUE_FLAG_DYING manipulation, but we know we can't call
flush_workqueue() while holding open_mutex.
Please post as a standalone patch (subject starting with "[PATCH" than "Re: [PATCH")
that can be applied on current linux.git tree, so that sashiko can review your patch.