Skip to content

Commit

Permalink
media: i2c: max9286: fix access 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 max9286_asd, otherwise access to max9286_asd->source will go to
unallocated memory.

Fixes: 86d37bf ("media: i2c: max9286: Allocate v4l2_async_subdev dynamically")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: stable@vger.kernel.org # v5.10+
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Tomi Valkeinen authored and Mauro Carvalho Chehab committed Feb 6, 2021
1 parent c432147 commit e88ccf0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/i2c/max9286.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ static int max9286_v4l2_notifier_register(struct max9286_priv *priv)

asd = v4l2_async_notifier_add_fwnode_subdev(&priv->notifier,
source->fwnode,
sizeof(*asd));
sizeof(struct max9286_asd));
if (IS_ERR(asd)) {
dev_err(dev, "Failed to add subdev for source %u: %ld",
i, PTR_ERR(asd));
Expand Down

0 comments on commit e88ccf0

Please sign in to comment.