Commit c88e739b authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab

[media] media: info leak in __media_device_enum_links()

These structs have holes and reserved struct members which aren't
cleared.  I've added a memset() so we don't leak stack information.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent fe905b8c
...@@ -142,6 +142,8 @@ static long __media_device_enum_links(struct media_device *mdev, ...@@ -142,6 +142,8 @@ static long __media_device_enum_links(struct media_device *mdev,
for (p = 0; p < entity->num_pads; p++) { for (p = 0; p < entity->num_pads; p++) {
struct media_pad_desc pad; struct media_pad_desc pad;
memset(&pad, 0, sizeof(pad));
media_device_kpad_to_upad(&entity->pads[p], &pad); media_device_kpad_to_upad(&entity->pads[p], &pad);
if (copy_to_user(&links->pads[p], &pad, sizeof(pad))) if (copy_to_user(&links->pads[p], &pad, sizeof(pad)))
return -EFAULT; return -EFAULT;
...@@ -159,6 +161,7 @@ static long __media_device_enum_links(struct media_device *mdev, ...@@ -159,6 +161,7 @@ static long __media_device_enum_links(struct media_device *mdev,
if (entity->links[l].source->entity != entity) if (entity->links[l].source->entity != entity)
continue; continue;
memset(&link, 0, sizeof(link));
media_device_kpad_to_upad(entity->links[l].source, media_device_kpad_to_upad(entity->links[l].source,
&link.source); &link.source);
media_device_kpad_to_upad(entity->links[l].sink, media_device_kpad_to_upad(entity->links[l].sink,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment