linux_dsm_epyc7002/drivers/media
sumitg 3e0f724346 media: v4l2-core: fix use-after-free error
Fixing use-after-free within __v4l2_ctrl_handler_setup().
Memory is being freed with kfree(new_ref) for duplicate
control reference entry but ctrl->cluster pointer is still
referring to freed duplicate entry resulting in error on
access. Change done to update cluster pointer only when new
control reference is added.

 ==================================================================
 BUG: KASAN: use-after-free in __v4l2_ctrl_handler_setup+0x388/0x428
 Read of size 8 at addr ffffffc324e78618 by task systemd-udevd/312

 Allocated by task 312:

 Freed by task 312:

 The buggy address belongs to the object at ffffffc324e78600
  which belongs to the cache kmalloc-64 of size 64
 The buggy address is located 24 bytes inside of
  64-byte region [ffffffc324e78600, ffffffc324e78640)
 The buggy address belongs to the page:
 page:ffffffbf0c939e00 count:1 mapcount:0 mapping:
					(null) index:0xffffffc324e78f80
 flags: 0x4000000000000100(slab)
 raw: 4000000000000100 0000000000000000 ffffffc324e78f80 000000018020001a
 raw: 0000000000000000 0000000100000001 ffffffc37040fb80 0000000000000000
 page dumped because: kasan: bad access detected

 Memory state around the buggy address:
  ffffffc324e78500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
  ffffffc324e78580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 >ffffffc324e78600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                             ^
  ffffffc324e78680: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
  ffffffc324e78700: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
 ==================================================================

Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-05-28 12:50:33 -04:00
..
cec Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
common Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
dvb-core Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
dvb-frontends Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
firewire treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
i2c Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
mc media: move drivers/media/media-* to drivers/media/mc/mc-* 2019-05-28 12:15:46 -04:00
mmc treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pci Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
platform media: rcar-csi2: Fix coccinelle warning for PTR_ERR_OR_ZERO() 2019-05-28 12:50:03 -04:00
radio Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
rc Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
spi Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
tuners Linux 5.2-rc2 2019-05-28 11:21:51 -04:00
usb media: pwc: convert to BIT macro 2019-05-28 12:38:08 -04:00
v4l2-core media: v4l2-core: fix use-after-free error 2019-05-28 12:50:33 -04:00
Kconfig media: move drivers/media/media-* to drivers/media/mc/mc-* 2019-05-28 12:15:46 -04:00
Makefile media: move drivers/media/media-* to drivers/media/mc/mc-* 2019-05-28 12:15:46 -04:00