android_kernel_oneplus_msm8998/drivers/media
Dan Carpenter 82077215ed media: pvrusb2: Prevent a buffer overflow
[ Upstream commit c1ced46c7b49ad7bc064e68d966e0ad303f917fb ]

The ctrl_check_input() function is called from pvr2_ctrl_range_check().
It's supposed to validate user supplied input and return true or false
depending on whether the input is valid or not.  The problem is that
negative shifts or shifts greater than 31 are undefined in C.  In
practice with GCC they result in shift wrapping so this function returns
true for some inputs which are not valid and this could result in a
buffer overflow:

    drivers/media/usb/pvrusb2/pvrusb2-ctrl.c:205 pvr2_ctrl_get_valname()
    warn: uncapped user index 'names[val]'

The cptr->hdw->input_allowed_mask mask is configured in pvr2_hdw_create()
and the highest valid bit is BIT(4).

Fixes: 7fb20fa38c ("V4L/DVB (7299): pvrusb2: Improve logic which handles input choice availability")

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>
2019-06-11 12:23:58 +02:00
..
common media: siano: get rid of __le32/__le16 cast warnings 2018-08-06 16:24:37 +02:00
dvb-core media: dvb_frontend: fix locking issues at dvb_frontend_get_event() 2018-07-03 11:21:33 +02:00
dvb-frontends media: dvb-frontends: fix i2c access helpers for KASAN 2018-12-17 21:55:17 +01:00
firewire media: firewire: Fix app_info parameter type in avc_ca{,_app}_info 2019-01-26 09:42:53 +01:00
i2c media: ov2659: make S_FMT succeed even if requested format doesn't match 2019-06-11 12:23:58 +02:00
mmc [media] siano: register media controller earlier 2015-02-26 09:10:39 -03:00
pci mm: replace get_user_pages_unlocked() write/force parameters with gup_flags 2018-12-17 21:55:16 +01:00
platform media: coda: clear error return value before picture run 2019-06-11 12:23:57 +02:00
radio media: si470x: fix __be16 annotations 2018-08-06 16:24:39 +02:00
rc mceusb: sporadic RX truncation corruption fix 2018-04-13 19:50:18 +02:00
tuners media: r820t: fix r820t_write_reg for KASAN 2018-02-22 15:45:02 +01:00
usb media: pvrusb2: Prevent a buffer overflow 2019-06-11 12:23:58 +02:00
v4l2-core media: v4l2-ctrls.c/uvc: zero v4l2_event 2019-04-03 06:23:16 +02:00
Kconfig media updates for v4.2-rc1 2015-06-25 17:55:48 -07:00
Makefile [media] bq/c-qcam, w9966, pms: move to staging in preparation for removal 2014-12-16 23:21:44 -02:00
media-device.c [media] media: Use strlcpy instead of custom code 2014-09-21 20:27:08 -03:00
media-devnode.c [media] media-devnode: just return 0 instead of using a var 2014-09-03 17:59:28 -03:00
media-entity.c [media] media-entity.c: get rid of var length arrays 2015-10-01 18:10:05 -03:00