Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: amphion: Cancel message work before releasing the VPU core

To avoid accessing the VPU register after release of the VPU core,
cancel the message work and destroy the workqueue that handles the
VPU message before release of the VPU core.

Fixes: 3cd084519c6f ("media: amphion: add vpu v4l2 m2m support")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Ming Qian and committed by
Hans Verkuil
ae246b00 634c2cd1

+3 -3
+3 -3
drivers/media/platform/amphion/vpu_v4l2.c
··· 703 703 { 704 704 vpu_trace(inst->vpu->dev, "%p\n", inst); 705 705 706 - vpu_release_core(inst->core); 707 - put_device(inst->dev); 708 - 709 706 if (inst->workqueue) { 710 707 cancel_work_sync(&inst->msg_work); 711 708 destroy_workqueue(inst->workqueue); 712 709 inst->workqueue = NULL; 713 710 } 711 + 712 + vpu_release_core(inst->core); 713 + put_device(inst->dev); 714 714 715 715 v4l2_ctrl_handler_free(&inst->ctrl_handler); 716 716 mutex_destroy(&inst->lock);