Re: [PATCH] staging: most: video: add comments to mutex and spinlock definitions
From: Muhammad Israr
Date: Sat Sep 12 2026 - 15:13:18 EST
On Sat, Sep 13, 2026 at 12:09:00PM +0000, Dan Carpenter wrote:
> Imagine one thread is calling get_top_mbo() which reads:
> list_first_entry(&mdev->pending_mbos, struct mbo, list);
> but the other thread is calling:
> list_del(&mbo->list);
> It's a race condition.
Right, that's the exact interleaving the mutex prevents with
read_lock held for the whole of comp_vdev_read(), a second thread
can never be inside get_top_mbo() while a first is inside
list_del(), since both calls happen inside the same
mutex-protected function body.
I'll write it up and send it as a patch.
regards,
Muhammad Israr