]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: rcar-csi2: Allocate v4l2_async_subdev dynamically
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 11 Aug 2020 20:59:38 +0000 (22:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:21 +0000 (10:07 +0100)
commit0f8c1ad5ed8fef72b396a5d7fa551a52f7c5f25e
tree61359ab0198d76ad9ddec4e4cfe314f7c6a4444a
parentbd48c278ba333678406db01c74620f24ca48d3b5
media: rcar-csi2: Allocate v4l2_async_subdev dynamically

[ Upstream commit 2cac7cbfb4099980e78244359ab9c6f056d6a7ec ]

v4l2_async_notifier_add_subdev() requires the asd to be allocated
dynamically, but the rcar-csi2 driver embeds it in the rcar_csi2
structure. This causes memory corruption when the notifier is destroyed
at remove time with v4l2_async_notifier_cleanup().

Fix this issue by registering the asd with
v4l2_async_notifier_add_fwnode_subdev(), which allocates it dynamically
internally.

Fixes: 769afd212b16 ("media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/rcar-vin/rcar-csi2.c