Skip to contentSkip to conversation

media: i2c: max9286: fix access to unallocated memory

git:media_tree/master Mauro Carvalho Chehab 1 participant 1 message Feb 6, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This is an automatic generated email to let you know that the following patch were queued:

Subject: media: i2c: max9286: fix access to unallocated memory
Author:  Tomi Valkeinen <[email protected]>
Date:    Mon Jan 18 09:14:46 2021 +0100

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 86d37bf31af6 ("media: i2c: max9286: Allocate v4l2_async_subdev dynamically")
Cc [email protected] # v5.10+
 drivers/media/i2c/max9286.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---

drivers/media/i2c/max9286.c +1 -1
index c82c1493e099..b1e2476d3c9e 100644
@@ -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));