]> www.infradead.org Git - users/jedix/linux-maple.git/commit
media: atomisp: Avoid deadlock with sensor subdevs with state_lock set
authorHans de Goede <hdegoede@redhat.com>
Thu, 1 May 2025 09:44:44 +0000 (11:44 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 5 May 2025 07:47:28 +0000 (09:47 +0200)
commitbceff719ef46078ddbc3f20298b7b79ad0f67889
treeb16b9e2b35f1cddbbf957ef72b1e5004a083ba08
parent72ebfff219459b062394fd2ad886b8e59e0195ca
media: atomisp: Avoid deadlock with sensor subdevs with state_lock set

When a (sensor) v4l2_subdev has its state_lock member set to non NULL,
then all v4l2_subdev_state-s for the sensor share the same lock.

atomisp_init_sensor() calls v4l2_subdev_lock_and_get_active_state() and
then later on also tries to lock a separate v4l2_subdev_state used for try
calls (rather then changing the active state), while still holding
the active state lock.

Since this try v4l2_subdev_state shares a lock with the active state this
results in a deadlock.

Skip locking try_sd_state when sensor->state_lock is set to avoid this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_v4l2.c