linux-stable/sound
Takashi Iwai fc27fe7e8d ALSA: seq: Cancel pending autoload work at unbinding device
ALSA sequencer core has a mechanism to load the enumerated devices
automatically, and it's performed in an off-load work.  This seems
causing some race when a sequencer is removed while the pending
autoload work is running.  As syzkaller spotted, it may lead to some
use-after-free:
  BUG: KASAN: use-after-free in snd_rawmidi_dev_seq_free+0x69/0x70
  sound/core/rawmidi.c:1617
  Write of size 8 at addr ffff88006c611d90 by task kworker/2:1/567

  CPU: 2 PID: 567 Comm: kworker/2:1 Not tainted 4.13.0+ #29
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  Workqueue: events autoload_drivers
  Call Trace:
   __dump_stack lib/dump_stack.c:16 [inline]
   dump_stack+0x192/0x22c lib/dump_stack.c:52
   print_address_description+0x78/0x280 mm/kasan/report.c:252
   kasan_report_error mm/kasan/report.c:351 [inline]
   kasan_report+0x230/0x340 mm/kasan/report.c:409
   __asan_report_store8_noabort+0x1c/0x20 mm/kasan/report.c:435
   snd_rawmidi_dev_seq_free+0x69/0x70 sound/core/rawmidi.c:1617
   snd_seq_dev_release+0x4f/0x70 sound/core/seq_device.c:192
   device_release+0x13f/0x210 drivers/base/core.c:814
   kobject_cleanup lib/kobject.c:648 [inline]
   kobject_release lib/kobject.c:677 [inline]
   kref_put include/linux/kref.h:70 [inline]
   kobject_put+0x145/0x240 lib/kobject.c:694
   put_device+0x25/0x30 drivers/base/core.c:1799
   klist_devices_put+0x36/0x40 drivers/base/bus.c:827
   klist_next+0x264/0x4a0 lib/klist.c:403
   next_device drivers/base/bus.c:270 [inline]
   bus_for_each_dev+0x17e/0x210 drivers/base/bus.c:312
   autoload_drivers+0x3b/0x50 sound/core/seq_device.c:117
   process_one_work+0x9fb/0x1570 kernel/workqueue.c:2097
   worker_thread+0x1e4/0x1350 kernel/workqueue.c:2231
   kthread+0x324/0x3f0 kernel/kthread.c:231
   ret_from_fork+0x25/0x30 arch/x86/entry/entry_64.S:425

The fix is simply to assure canceling the autoload work at removing
the device.

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-09-12 12:41:20 +02:00
..
aoa ALSA: aoa: Convert to using %pOF instead of full_name 2017-08-29 14:52:17 +02:00
arm ALSA: aaci: constify ac97_pcm structures 2017-08-23 15:53:37 +02:00
atmel ASoC: Updates for v4.14 2017-09-04 14:50:49 +02:00
core ALSA: seq: Cancel pending autoload work at unbinding device 2017-09-12 12:41:20 +02:00
drivers ALSA: vx: Put missing KERN_CONT prefix 2017-08-31 11:01:17 +02:00
firewire ALSA: firewire: Use common error handling code in snd_motu_stream_start_duplex() 2017-09-12 09:23:26 +02:00
hda ALSA: hda: constify pci_device_id. 2017-07-18 20:01:21 +02:00
i2c ALSA: ak411x: Use array instead of offsetof() 2017-05-17 07:13:03 +02:00
isa ALSA: isa: make snd_pcm_hardware const 2017-08-17 12:44:11 +02:00
mips ALSA: mips: constify snd_pcm_ops structures 2017-08-19 11:02:18 +02:00
oss Annotate hardware config module parameters in sound/oss/ 2017-04-20 12:02:32 +01:00
parisc ALSA: parisc: constify snd_pcm_ops structures 2017-08-19 11:02:19 +02:00
pci ALSA: asihpi: Kill BUG_ON() usages 2017-09-07 10:52:37 +02:00
pcmcia ALSA: pcmcia: constify snd_pcm_ops structures 2017-08-19 11:02:21 +02:00
ppc ALSA: ppc: constify snd_pcm_ops structures 2017-08-19 11:02:22 +02:00
sh ALSA: sh: Put missing KERN_* prefix 2017-08-31 11:02:15 +02:00
soc ASoC: Fixes for the CS43130 driver 2017-09-04 18:13:29 +02:00
sparc ALSA: sparc: constify snd_pcm_ops structures 2017-08-19 11:02:24 +02:00
spi ALSA: spi: constify snd_pcm_ops structures 2017-08-19 11:02:26 +02:00
synth ALSA: emux: Delete two error messages for a failed memory allocation in snd_emux_create_port() 2017-08-10 17:55:13 +02:00
usb ALSA: 6fire: Use common error handling code in usb6fire_chip_probe() 2017-09-07 10:29:35 +02:00
x86 main drm pull for v4.13 2017-07-09 18:48:37 -07:00
ac97_bus.c
Kconfig ALSA: synth: Select snd-emux-synth explicitly 2017-06-09 22:10:06 +02:00
last.c
Makefile ALSA: add Intel HDMI LPE audio driver for BYT/CHT-T 2017-01-25 14:23:46 +01:00
sound_core.c