linux_dsm_epyc7002/drivers/media/rc
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
..
img-ir [media] rc: split nec protocol into its three variants 2016-09-22 11:46:49 -03:00
keymaps [media] Convert Wideview WT220 DVB USB driver to rc-core 2016-07-09 12:10:33 -03:00
ati_remote.c [media] rc: don't break long lines 2016-10-21 10:07:34 -02:00
ene_ir.c [media] rc: don't break long lines 2016-10-21 10:07:34 -02:00
ene_ir.h [media] ene_ir: don't use pr_debug after all 2013-07-29 11:49:45 -03:00
fintek-cir.c [media] squash lines for simple wrapper functions 2016-11-16 13:28:40 -02:00
fintek-cir.h [media] rc: Fir warnings on m68k arch 2013-11-08 09:45:37 -02:00
gpio-ir-recv.c [media] rc: gpio-ir-recv: add timeout on idle 2015-11-19 07:46:33 -02:00
igorplugusb.c [media] rc: split nec protocol into its three variants 2016-09-22 11:46:49 -03:00
iguanair.c [media] rc: make s_tx_carrier consistent 2016-07-15 11:54:23 -03:00
imon.c [media] imon: use complete() instead of complete_all() 2016-10-24 17:39:43 -02:00
ir-hix5hd2.c [media] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND 2015-10-22 15:48:24 -02:00
ir-jvc-decoder.c [media] media: rc: move check whether a protocol is enabled to the core 2015-11-19 11:39:17 -02:00
ir-lirc-codec.c [media] redrat3: make hardware timeout configurable 2016-07-15 12:01:46 -03:00
ir-mce_kbd-decoder.c [media] media: rc: move check whether a protocol is enabled to the core 2015-11-19 11:39:17 -02:00
ir-nec-decoder.c [media] rc: split nec protocol into its three variants 2016-09-22 11:46:49 -03:00
ir-rc5-decoder.c [media] Fix RC5 decoding with Fintek CIR chipset 2016-07-09 11:47:28 -03:00
ir-rc6-decoder.c [media] rc: rc6 decoder should report protocol correctly 2016-09-22 11:42:29 -03:00
ir-rx51.c ir-rx51: use hrtimer instead of dmtimer 2016-06-29 21:54:35 -07:00
ir-sanyo-decoder.c [media] media: rc: move check whether a protocol is enabled to the core 2015-11-19 11:39:17 -02:00
ir-sharp-decoder.c [media] media: rc: move check whether a protocol is enabled to the core 2015-11-19 11:39:17 -02:00
ir-sony-decoder.c [media] media: rc: move check whether a protocol is enabled to the core 2015-11-19 11:39:17 -02:00
ir-xmp-decoder.c [media] media: rc: move check whether a protocol is enabled to the core 2015-11-19 11:39:17 -02:00
ite-cir.c [media] ite-cir: initialize use_demodulator before using it 2016-10-24 17:19:28 -02:00
ite-cir.h [media] ite-cir: 8709 needs to use pnp resource 2 2011-07-01 16:31:38 -03:00
Kconfig ir-rx51: Fix build after multiarch changes broke it 2016-06-29 21:46:31 -07:00
lirc_dev.c [media] lirc_dev: remove compat_ioctl assignment 2016-11-18 14:16:09 -02:00
Makefile [media] media: rc: add driver for Amlogic Meson IR remote receiver 2014-11-26 13:29:01 -02:00
mceusb.c [media] rc: don't break long lines 2016-10-21 10:07:34 -02:00
meson-ir.c [media] rc: meson-ir: Fix module autoload 2016-11-16 13:20:11 -02:00
nuvoton-cir.c [media] rc: nuvoton: use managed versions of rc_allocate_device and rc_register_device 2016-10-24 18:29:49 -02:00
nuvoton-cir.h [media] media: rc: nuvoton: remove two unused elements in struct nvt_dev 2016-07-08 17:19:35 -03:00
rc-core-priv.h [media] media: rc: raw: improve FIFO handling 2016-01-25 12:38:09 -02:00
rc-ir-raw.c [media] rc: ir-raw: change type of available_protocols to atomic64_t 2016-10-24 18:16:06 -02:00
rc-loopback.c Revert "[media] rc: rc-loopback: Add loopback of filter scancodes" 2015-08-19 07:02:53 -03:00
rc-main.c [media] rc-main: clear rc_map.name in ir_free_table() 2016-11-18 14:31:34 -02:00
redrat3.c [media] RedRat3: Return directly after a failed rc_allocate_device() in redrat3_init_rc_dev() 2016-11-18 10:55:59 -02:00
st_rc.c [media] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag 2015-11-19 06:46:05 -02:00
streamzap.c [media] rc: don't break long lines 2016-10-21 10:07:34 -02:00
sunxi-cir.c [media] rc: sunxi-cir: support module autoloading 2016-03-03 12:42:34 -03:00
ttusbir.c [media] rc-core: remove protocol arrays 2014-07-25 19:10:43 -03:00
winbond-cir.c [media] winbond-cir: Use kmalloc_array() in wbcir_tx() 2016-11-18 11:04:29 -02:00