Skip to content

Commit

Permalink
media: ti-vpe: cal: fix write to unallocated memory
Browse files Browse the repository at this point in the history
The asd allocated with v4l2_async_notifier_add_fwnode_subdev() must be
of size cal_v4l2_async_subdev, otherwise access to
cal_v4l2_async_subdev->phy will go to unallocated memory.

Fixes: 8fcb757 ("media: ti-vpe: cal: Allow multiple contexts per subdev notifier")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Tomi Valkeinen authored and Mauro Carvalho Chehab committed Jan 14, 2021
1 parent 3b3bf0e commit 5a402af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/platform/ti-vpe/cal.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ static irqreturn_t cal_irq(int irq_cal, void *data)
*/

struct cal_v4l2_async_subdev {
struct v4l2_async_subdev asd;
struct v4l2_async_subdev asd; /* Must be first */
struct cal_camerarx *phy;
};

Expand Down Expand Up @@ -694,7 +694,7 @@ static int cal_async_notifier_register(struct cal_dev *cal)
fwnode = of_fwnode_handle(phy->sensor_node);
asd = v4l2_async_notifier_add_fwnode_subdev(&cal->notifier,
fwnode,
sizeof(*asd));
sizeof(*casd));
if (IS_ERR(asd)) {
phy_err(phy, "Failed to add subdev to notifier\n");
ret = PTR_ERR(asd);
Expand Down

0 comments on commit 5a402af

Please sign in to comment.