media: chips-media: wave5: Avoid race condition in the interrupt handler
commit ac35f768986610480a1c01323d9cf9f5eaf3ee9b upstream.
In case of multiple active instances, new interrupts can occur as soon
as the current interrupt is cleared. If the driver reads the
instance_info after clearing the interrupt, then there is no guarantee,
that the instance_info is still valid for the current interrupt.
Read the instance_info register for each interrupt before clearing the
interrupt.
Fixes: ed7276ed2f ("media: chips-media: wave5: Add hrtimer based polling support")
Cc: stable@vger.kernel.org
Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7fafaf00cc
commit
76cab9f540
@@ -54,12 +54,12 @@ static void wave5_vpu_handle_irq(void *dev_id)
|
||||
struct vpu_device *dev = dev_id;
|
||||
|
||||
irq_reason = wave5_vdi_read_register(dev, W5_VPU_VINT_REASON);
|
||||
seq_done = wave5_vdi_read_register(dev, W5_RET_SEQ_DONE_INSTANCE_INFO);
|
||||
cmd_done = wave5_vdi_read_register(dev, W5_RET_QUEUE_CMD_DONE_INST);
|
||||
wave5_vdi_write_register(dev, W5_VPU_VINT_REASON_CLR, irq_reason);
|
||||
wave5_vdi_write_register(dev, W5_VPU_VINT_CLEAR, 0x1);
|
||||
|
||||
list_for_each_entry(inst, &dev->instances, list) {
|
||||
seq_done = wave5_vdi_read_register(dev, W5_RET_SEQ_DONE_INSTANCE_INFO);
|
||||
cmd_done = wave5_vdi_read_register(dev, W5_RET_QUEUE_CMD_DONE_INST);
|
||||
|
||||
if (irq_reason & BIT(INT_WAVE5_INIT_SEQ) ||
|
||||
irq_reason & BIT(INT_WAVE5_ENC_SET_PARAM)) {
|
||||
|
||||
Reference in New Issue
Block a user