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)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 8 May 2019 17:58:49 +0000 (13:58 -0400)
commitdd6e2a981bfe83aa4a493143fd8cf1edcda6c091
tree61bb7db93ae43d39556f39c38a5e927141f746ce
parent583958cba72ffd092e9e3c8a8a284cb154c34b1c
media: omap_vout: potential buffer overflow in vidioc_dqbuf()

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>
drivers/media/platform/omap/omap_vout.c