linux-stable/drivers/media
Max Kellermann c183d3584b [media] rc-main: clear rc_map.name in ir_free_table()
rc_unregister_device() will first call ir_free_table(), and later
device_del(); however, the latter causes a call to rc_dev_uevent(),
which prints rc_map.name, which at this point has already bee freed.

This fixes a use-after-free bug found with KASAN.

As reported by Shuah:

 "I am seeing the following when I do rmmod on au0828

  BUG: KASAN: use-after-free in string+0x170/0x1f0 at addr ffff8801bd513000
  Read of size 1 by task rmmod/1831
  CPU: 1 PID: 1831 Comm: rmmod Tainted: G        W       4.9.0-rc5 #5
  Hardware name: Hewlett-Packard HP ProBook 6475b/180F, BIOS 68TTU Ver. F.04 08/03/2012
  ffff8801aea2f680 ffffffff81b37ad3 ffff8801fa403b80 ffff8801bd513000
  ffff8801aea2f6a8 ffffffff8156c301 ffff8801aea2f738 ffff8801bd513000
  ffff8801fa403b80 ffff8801aea2f728 ffffffff8156c59a ffff8801aea2f770
  Call Trace:
  dump_stack+0x67/0x94
  [<ffffffff8156c301>] kasan_object_err+0x21/0x70
  [<ffffffff8156c59a>] kasan_report_error+0x1fa/0x4d0
  [<ffffffffa116f05f>] ? au0828_exit+0x10/0x21 [au0828]
  [<ffffffff8156c8b3>] __asan_report_load1_noabort+0x43/0x50
  [<ffffffff81b58b20>] ? string+0x170/0x1f0
  [<ffffffff81b58b20>] string+0x170/0x1f0
  [<ffffffff81b621c4>] vsnprintf+0x374/0x1c50
  [<ffffffff81b61e50>] ? pointer+0xa80/0xa80
  [<ffffffff8156b676>] ? save_stack+0x46/0xd0
  [<ffffffff81566faa>] ? __kmalloc+0x14a/0x2a0
  [<ffffffff81b3d70a>] ? kobject_get_path+0x9a/0x200
  [<ffffffff81b408c2>] ? kobject_uevent_env+0x282/0xca0
  [<ffffffff81b412eb>] ? kobject_uevent+0xb/0x10
  [<ffffffff81f10104>] ? device_del+0x434/0x6d0
  [<ffffffffa0fea717>] ? rc_unregister_device+0x177/0x240 [rc_core]
  [<ffffffffa116eeb0>] ? au0828_rc_unregister+0x60/0xb0 [au0828]

 The problem is fixed with this patch on Linux 4.9-rc4"

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Tested-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 14:31:34 -02:00
..
cec [media] cec: zero counters in cec_received_msg() 2016-11-16 15:49:01 -02:00
common [media] tveeprom: print log messages using pr_foo() 2016-11-18 10:13:11 -02:00
dvb-core [media] squash lines for simple wrapper functions 2016-11-16 13:28:40 -02:00
dvb-frontends [media] dibx000_common: use pr_foo() instead of printk() 2016-11-18 10:01:56 -02:00
firewire [media] firewire: don't break long lines 2016-10-21 10:06:00 -02:00
i2c [media] tvp5150: get rid of KERN_CONT 2016-11-18 10:11:09 -02:00
mmc
pci [media] saa7134: fix warm Medion 7134 EEPROM read 2016-11-18 14:04:53 -02:00
platform [media] media: platform: ti-vpe: call of_node_put on non-null pointer 2016-11-18 14:23:33 -02:00
radio [media] wl128x: use KERNEL_CONT where needed 2016-11-18 09:37:24 -02:00
rc [media] rc-main: clear rc_map.name in ir_free_table() 2016-11-18 14:31:34 -02:00
spi [media] gs1662: drop kfree for memory allocated with devm_kzalloc 2016-10-24 17:59:08 -02:00
tuners [media] tuners: don't break long lines 2016-10-21 10:08:13 -02:00
usb [media] dvb-usb-cxusb: Geniatech T230 - resync TS FIFO after lock 2016-11-18 13:46:28 -02:00
v4l2-core [media] tuner-core: use pr_foo, instead of internal printk macros 2016-11-18 10:04:28 -02:00
cec-edid.c
Kconfig [media] cec: move the CEC framework out of staging and to media 2016-11-16 15:40:20 -02:00
Makefile [media] cec: move the CEC framework out of staging and to media 2016-11-16 15:40:20 -02:00
media-device.c
media-devnode.c
media-entity.c