Bug 51201

Summary: Kernel crashes at snd_usbmidi_output_close() when device is removed
Product: Drivers Reporter: Mauro Carvalho Chehab (mchehab)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: florian, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.6.7-4.fc17.x86_64 Subsystem:
Regression: No Bisected commit-id:
Attachments: Kernel OOPS message
lsusb for DigiTech RP255 Guitar Multi-Effects Processor
patch1
patch2

Description Mauro Carvalho Chehab 2012-12-01 12:34:36 UTC
Created attachment 88041 [details]
Kernel OOPS message

There's something wrong at snd_usbmidi_output_close(). When using gdigi with a Digitech RP-255 pedal, sometimes I disconnect the pedal before closing gdigi.

When gdigi is later closed, Kernel panics at snd_usbmidi_output_close(). I suspect that there are some missing tests there, to see if the device's data
are still there.

The end result is a Kernel panic:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000190
IP: [<ffffffff8143fb54>] usb_autopm_put_interface+0x14/0x40
...
Call Trace:
[<ffffffffa078f809>] snd_usbmidi_output_close+0x29/0x40 [snd_usbmidi_lib]
...

I'm attaching the full OOPS message, and the lsusb -v info of the device.
Comment 1 Mauro Carvalho Chehab 2012-12-01 12:36:15 UTC
Created attachment 88051 [details]
lsusb for DigiTech RP255 Guitar Multi-Effects Processor
Comment 2 Takashi Iwai 2012-12-04 07:03:51 UTC
The patches below should fix the issue.  Please try them out.
These were merged in sound git tree for-next branch, too.
    git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
Comment 3 Takashi Iwai 2012-12-04 07:04:13 UTC
Created attachment 88381 [details]
patch1
Comment 4 Takashi Iwai 2012-12-04 07:04:33 UTC
Created attachment 88391 [details]
patch2
Comment 5 Florian Mickler 2012-12-22 09:21:00 UTC
A patch referencing this bug report has been merged in Linux v3.8-rc1:

commit 59866da9e4ae54819e3c4e0a8f426bdb0c2ef993
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Dec 3 11:12:46 2012 +0100

    ALSA: usb-audio: Avoid autopm calls after disconnection