]> git.baikalelectronics.ru Git - kernel.git/commit
media: atomisp: Fix locking around asd->streaming read/write
authorHans de Goede <hdegoede@redhat.com>
Fri, 2 Sep 2022 11:39:51 +0000 (13:39 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 08:05:14 +0000 (10:05 +0200)
commita4259584007d9a786a2918653ba6dd5645a2a7d6
treeeadb410538fedcd2ab331b1ef6920b91e4fdd2c8
parent82537af7a3854f2d6fd31be31764a5b6090d79a1
media: atomisp: Fix locking around asd->streaming read/write

For reading / writing the asd->streaming enum the following rules
should be followed:

1. Writers of streaming must hold both isp->mutex and isp->lock.
2. Readers of streaming need to hold only one of the two locks.

Not all writers where properly taking both locks this fixes this.

In the case of the readers, many readers depend on their caller
to hold isp->mutex, add asserts for this

And in the case of atomisp_css_get_dis_stat() it is called with
isp->mutex held, so there is no need to take the spinlock just
for reading the streaming value.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
drivers/staging/media/atomisp/pci/atomisp_fops.c
drivers/staging/media/atomisp/pci/atomisp_internal.h
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_subdev.c
drivers/staging/media/atomisp/pci/atomisp_subdev.h