WSL2-Linux-Kernel/sound/usb/line6
Takashi Iwai c95072b3d8 ALSA: line6: Fix leftover URB at error-path during probe
While line6_probe() may kick off URB for a control MIDI endpoint, the
function doesn't clean up it properly at its error path.  This results
in a leftover URB action that is eventually triggered later and causes
an Oops like:
  general protection fault: 0000 [#1] PREEMPT SMP KASAN
  CPU: 1 PID: 0 Comm: swapper/1 Not tainted
  RIP: 0010:usb_fill_bulk_urb ./include/linux/usb.h:1619
  RIP: 0010:line6_start_listen+0x3fe/0x9e0 sound/usb/line6/driver.c:76
  Call Trace:
   <IRQ>
   line6_data_received+0x1f7/0x470 sound/usb/line6/driver.c:326
   __usb_hcd_giveback_urb+0x2e0/0x650 drivers/usb/core/hcd.c:1779
   usb_hcd_giveback_urb+0x337/0x420 drivers/usb/core/hcd.c:1845
   dummy_timer+0xba9/0x39f0 drivers/usb/gadget/udc/dummy_hcd.c:1965
   call_timer_fn+0x2a2/0x940 kernel/time/timer.c:1281
   ....

Since the whole clean-up procedure is done in line6_disconnect()
callback, we can simply call it in the error path instead of
open-coding the whole again.  It'll fix such an issue automagically.

The bug was spotted by syzkaller.

Fixes: eedd0e95d3 ("ALSA: line6: Don't forget to call driver's destructor at error path")
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-10-09 16:17:18 +02:00
..
Kconfig ALSA: line6: snd-usb-line6 depends on CONFIG_SND_HWDEP 2016-09-21 14:36:22 +02:00
Makefile ALSA: line6: Reorganize card resource handling 2015-01-20 08:17:16 +01:00
capture.c ALSA: line6: Add LINE6_CAP_IN_NEEDS_OUT, a void playback stream during capture 2016-09-19 23:00:37 +02:00
capture.h ALSA: line6: Reorganize PCM stream handling 2015-01-28 07:22:36 +01:00
driver.c ALSA: line6: Fix leftover URB at error-path during probe 2017-10-09 16:17:18 +02:00
driver.h ALSA: line6: remove unnecessary initialization to PODHD500X 2017-06-20 07:51:22 +02:00
midi.c ALSA: usb: Constify snd_rawmidi_ops 2017-01-12 12:50:48 +01:00
midi.h ALSA: line6: Tidy up and typo fixes in comments 2015-01-28 20:54:43 +01:00
midibuf.c ALSA: line6: Remove unused line6_midibuf_skip_message() 2015-02-01 09:35:25 +01:00
midibuf.h ALSA: line6: Remove unused line6_midibuf_skip_message() 2015-02-01 09:35:25 +01:00
pcm.c ALSA: usb-line6: constify snd_kcontrol_new strucutre array 2017-04-14 08:57:56 +02:00
pcm.h ALSA: line6: Add LINE6_CAP_IN_NEEDS_OUT, a void playback stream during capture 2016-09-19 23:00:37 +02:00
playback.c ALSA: line6: Allow different channel numbers for in/out 2016-09-19 23:00:16 +02:00
playback.h ALSA: line6: Reorganize PCM stream handling 2015-01-28 07:22:36 +01:00
pod.c ALSA: line6: constify snd_kcontrol_new structures 2017-04-12 15:35:16 +02:00
podhd.c ALSA: line6: Fix NULL dereference at podhd_disconnect() 2017-10-09 16:17:09 +02:00
toneport.c ALSA: line6: constify snd_kcontrol_new structures 2017-04-12 15:35:16 +02:00
variax.c ALSA: line6: Distinguish device init (ctrl EP) and MIDI data transfer (int EP) 2016-09-19 23:00:47 +02:00