diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2021-04-23 10:00:49 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-05-19 09:51:39 +0200 |
commit | 3d37ef41bed0854805ab9af22c422267510e1344 (patch) | |
tree | a4f8c4bc364da63870d8d2ec3d343a379276d9d1 /drivers/media/pci/cobalt/cobalt-driver.c | |
parent | b2cd0b31ed896c1a6a423019ed3633e890a7f997 (diff) |
media: cobalt: fix race condition in setting HPD
The cobalt_s_bit_sysctrl reads the old register value over PCI,
then changes a bit and sets writes the new value to the register.
This is used among other things for setting the HPD output pin.
But if the HPD is changed for multiple inputs at the same time,
then this causes a race condition where a stale value is read.
Serialize this function with a mutex.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/pci/cobalt/cobalt-driver.c')
-rw-r--r-- | drivers/media/pci/cobalt/cobalt-driver.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c index 839503e654f4..16af58f2f93c 100644 --- a/drivers/media/pci/cobalt/cobalt-driver.c +++ b/drivers/media/pci/cobalt/cobalt-driver.c @@ -667,6 +667,7 @@ static int cobalt_probe(struct pci_dev *pci_dev, return -ENOMEM; cobalt->pci_dev = pci_dev; cobalt->instance = i; + mutex_init(&cobalt->pci_lock); retval = v4l2_device_register(&pci_dev->dev, &cobalt->v4l2_dev); if (retval) { |