]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
media: imx: Fix csc/scaler unregister
authorEzequiel Garcia <ezequiel@collabora.com>
Mon, 4 Jan 2021 20:34:40 +0000 (21:34 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 15 Mar 2021 14:09:05 +0000 (15:09 +0100)
commitea2025ee250e965953e78c45f139278790e14c57
tree4649f10e019430b843e26087bc316bd4c854a0b5
parentcc0f459236097e9f0c831593944f278f90b5c640
media: imx: Fix csc/scaler unregister

[ Upstream commit 89b14485caa4b7b2eaf70be0064f0978e68ebeee ]

The csc/scaler device private struct is released by
ipu_csc_scaler_video_device_release(), which can be called
by video_unregister_device() if there are no users
of the underlying struct video device.

Therefore, the mutex can't be held when calling
video_unregister_device() as its memory may be freed
by it, leading to a kernel oops.

Fortunately, the fix is quite simple as no locking
is needed when calling video_unregister_device(): v4l2-core
already has its own internal locking, and the structures
are also properly refcounted.

Fixes: a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/staging/media/imx/imx-media-csc-scaler.c