[Devel] [PATCH hci-8.2 v11 6/9] dm-ploop: fix use-after-free on the last inflight_md decrement

Konstantin Khorenko khorenko at virtuozzo.com
Fri Nov 20 14:03:26 MSK 2026


I won't apply this version, please send v12, items 2 and 3 of the
cover letter reply.

On Fri, 20 Nov 2026 09:16:59 +0100, Alexander Ivanov wrote:
> +		/* BAT writes may still be completing from aio context */
> +		wait_event(ploop->inflight_md_wq,
> +			   !atomic_read(&ploop->inflight_md));
> +		/* Wait for ploop_dec_inflight_md() to drop the lock */
> +		spin_lock_irq(&ploop->inflight_md_wq.lock);
> +		spin_unlock_irq(&ploop->inflight_md_wq.lock);

Item 2: on hci-8.2 ploop_destroy() already waits for file_io_ref,
which covers every completion that drops the last piwb reference.

> Nothing on the suspend or destroy path waits for inflight_md, and the
> one waiter that exists, ploop_suspend_submitting_pios(), checks the

Item 3: with 8/9 postsuspend and preresume do wait for it,
uninterruptibly, so wake_up_interruptible() is the bug left on
hci-8.2.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list