linux-stable/drivers/staging/media
Dan Carpenter 8033120f36 media: atomisp2: array underflow in imx_enum_frame_size()
The code looks in imx_enum_frame_size() looks like this:

  2066          int index = fse->index;
  2067          struct imx_device *dev = to_imx_sensor(sd);
  2068
  2069          mutex_lock(&dev->input_lock);
  2070          if (index >= dev->entries_curr_table) {
  2071                  mutex_unlock(&dev->input_lock);
  2072                  return -EINVAL;
  2073          }
  2074
  2075          fse->min_width = dev->curr_res_table[index].width;

"fse->index" is a u32 that comes from the user.  We want negative values
of "index" to be -EINVAL so we don't read before the start of the
dev->curr_res_table[] array.  I've made "entries_curr_table" unsigned
long to fix this.  I thought about making it unsigned int, but because
of struct alignment, it doesn't use more memory either way.

Fixes: a49d25364d ("staging/atomisp: Add support for the Intel IPU v2")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-07-26 08:26:21 -04:00
..
atomisp media: atomisp2: array underflow in imx_enum_frame_size() 2017-07-26 08:26:21 -04:00
bcm2048 [media] media: bcm2048: fix several macros 2017-04-10 14:44:08 -03:00
cxd2099 media: staging: cxd2099: Activate cxd2099 buffer mode 2017-06-26 08:19:13 -03:00
davinci_vpfe Staging: media: Unmap and release region obtained by ioremap_nocache 2017-03-21 08:52:29 +01:00
imx [media] media: imx: Drop warning upon multiple S_STREAM disable calls 2017-06-20 08:12:20 -03:00
lirc [media] staging: remove todo and replace with lirc_zilog todo 2017-06-06 09:18:08 -03:00
omap4iss [media] staging: media: omap4iss: Replace a bit shift by a use of BIT 2017-04-18 12:13:11 -03:00
Kconfig [media] media: Add i.MX media core driver 2017-06-20 07:30:38 -03:00
Makefile [media] media: Add i.MX media core driver 2017-06-20 07:30:38 -03:00