Skip to content

Commit 6073cb5

Browse files
haruki3hhhgregkh
authored andcommitted
media: chips-media: wave5: add missing spinlock protection for handle_dynamic_resolution_change()
commit cb8bdd3 upstream. Add spin_lock_irqsave()/spin_unlock_irqrestore() around the handle_dynamic_resolution_change() call in initialize_sequence() to fix the missing lock protection. initialize_sequence() calls handle_dynamic_resolution_change() without holding inst->state_spinlock. However, handle_dynamic_resolution_change() has lockdep_assert_held(&inst->state_spinlock) indicating that callers must hold this lock. Other callers of handle_dynamic_resolution_change() properly acquire the spinlock: - wave5_vpu_dec_finish_decode() - wave5_vpu_dec_device_run() Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Fixes: 9707a62 ("media: chips-media: wave5: Add the v4l2 layer") Cc: stable@vger.kernel.org Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0d11fd9 commit 6073cb5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ static int initialize_sequence(struct vpu_instance *inst)
16251625
{
16261626
struct dec_initial_info initial_info;
16271627
int ret = 0;
1628+
unsigned long flags;
16281629

16291630
memset(&initial_info, 0, sizeof(struct dec_initial_info));
16301631

@@ -1646,7 +1647,9 @@ static int initialize_sequence(struct vpu_instance *inst)
16461647
return ret;
16471648
}
16481649

1650+
spin_lock_irqsave(&inst->state_spinlock, flags);
16491651
handle_dynamic_resolution_change(inst);
1652+
spin_unlock_irqrestore(&inst->state_spinlock, flags);
16501653

16511654
return 0;
16521655
}

0 commit comments

Comments
 (0)