]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
media: omap_vout: potential buffer overflow in vidioc_dqbuf()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 11 Apr 2019 09:01:57 +0000 (05:01 -0400)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commited8d35765bfca31800c29f530a9f437965de28ef
tree64e80f40d78678f5d203f3af02637c27c4b689c7
parent67c05c4f01641f20d32f8897f94d235fbda5a934
media: omap_vout: potential buffer overflow in vidioc_dqbuf()

BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit dd6e2a981bfe83aa4a493143fd8cf1edcda6c091 ]

The "b->index" is a u32 the comes from the user in the ioctl.  It hasn't
been checked.  We aren't supposed to use it but we're instead supposed
to use the value that gets written to it when we call videobuf_dqbuf().

The videobuf_dqbuf() first memsets it to zero and then re-initializes it
inside the videobuf_status() function.  It's this final value which we
want.

Hans Verkuil pointed out that we need to check the return from
videobuf_dqbuf().  I ended up doing a little cleanup related to that as
well.

Fixes: 72915e851da9 ("[media] V4L2: OMAP: VOUT: dma map and unmap v4l2 buffers in qbuf and dqbuf")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/platform/omap/omap_vout.c