From patchwork Wed Mar 11 11:55:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5983671 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F237C9F318 for ; Wed, 11 Mar 2015 11:55:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC5FE2041E for ; Wed, 11 Mar 2015 11:55:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7296C203E3 for ; Wed, 11 Mar 2015 11:55:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6B3AB265262; Wed, 11 Mar 2015 12:55:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 118BE26057F; Wed, 11 Mar 2015 12:55:29 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1BE37265196; Wed, 11 Mar 2015 12:55:27 +0100 (CET) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 2F77126057B for ; Wed, 11 Mar 2015 12:55:20 +0100 (CET) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E98B1AAC8; Wed, 11 Mar 2015 11:55:19 +0000 (UTC) Date: Wed, 11 Mar 2015 12:55:19 +0100 Message-ID: From: Takashi Iwai To: Fengguang Wu In-Reply-To: <20150311103748.GA13922@wfg-t540p.sh.intel.com> References: <20150311103748.GA13922@wfg-t540p.sh.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.4 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org, LKP , linux-kernel@vger.kernel.org Subject: Re: [alsa-devel] [ALSA/seq] BUG: unable to handle kernel NULL pointer dereference at 00000050 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP At Wed, 11 Mar 2015 18:37:48 +0800, Fengguang Wu wrote: > Greetings, > > 0day kernel testing robot got the below dmesg and the first bad commit is > > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > commit 7c37ae5c625aaa4836466cfaea829a3199dfc571 > Author: Takashi Iwai > AuthorDate: Thu Feb 12 10:51:59 2015 +0100 > Commit: Takashi Iwai > CommitDate: Thu Feb 12 11:35:11 2015 +0100 > > ALSA: seq: Rewrite sequencer device binding with standard bus > > We've used the old house-made code for binding the sequencer device > and driver. This can be far better implemented with the standard > bus nowadays. > > This patch refactors the whole sequencer binding code with the bus > /sys/bus/snd_seq. The devices appear as id-card-device on this bus > and are bound with the drivers corresponding to the given id like the > former implementation. The module autoload is also kept like before. > > There is no change in API functions by this patch, and almost all > transitions are kept inside seq_device.c. The proc file output will > change slightly but kept compatible as much as possible. > > Further integration works will follow in later patches. > > Signed-off-by: Takashi Iwai > > +------------------------------------------+------------+------------+-----------------+ > | | 72496edcf8 | 7c37ae5c62 | v4.0-rc3_031010 | > +------------------------------------------+------------+------------+-----------------+ > | boot_successes | 79 | 0 | 0 | > | boot_failures | 1 | 20 | 14 | > | BUG:kernel_boot_crashed | 1 | | | > | BUG:unable_to_handle_kernel | 0 | 20 | 14 | > | Oops | 0 | 20 | 14 | > | EIP_is_at_bus_add_device | 0 | 20 | 14 | > | Kernel_panic-not_syncing:Fatal_exception | 0 | 20 | 14 | > | backtrace:usb_composite_probe | 0 | 20 | 14 | > | backtrace:midi_driver_init | 0 | 20 | 14 | > | backtrace:kernel_init_freeable | 0 | 20 | 14 | > +------------------------------------------+------------+------------+-----------------+ > > [ 1.178531] udc dummy_udc.0: registering UDC driver [MIDI Gadget] > [ 1.179260] MIDI Gadget gadget: adding config #1 'MIDI Gadget'/c1f006c0 > [ 1.184102] MIDI Gadget gadget: adding 'gmidi function'/d1fab310 to config 'MIDI Gadget'/c1f006c0 > [ 1.186606] BUG: unable to handle kernel NULL pointer dereference at 00000050 > [ 1.187008] IP: [] bus_add_device+0xd6/0x160 > [ 1.187008] *pde = 00000000 > [ 1.187008] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC > [ 1.187008] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.19.0-03415-g7c37ae5 #24 > [ 1.187008] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 > [ 1.187008] task: d3480000 ti: d346a000 task.ti: d346a000 > [ 1.187008] EIP: 0060:[] EFLAGS: 00010246 CPU: 0 > [ 1.187008] EIP is at bus_add_device+0xd6/0x160 > [ 1.187008] EAX: 00000000 EBX: 00000000 ECX: d1fb7cc0 EDX: d1fa90bc > [ 1.187008] ESI: d1fa90bc EDI: c1f4f800 EBP: d346bb44 ESP: d346bb30 > [ 1.187008] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 > [ 1.187008] CR0: 80050033 CR2: 00000050 CR3: 02023000 CR4: 000406d0 > [ 1.187008] Stack: > [ 1.187008] c1291226 d1fa90b4 d1fa90bc d1f78c7c 00000000 d346bb84 c158e80a d1fa90bc > [ 1.187008] d1f78c84 00000000 00000002 00000000 00000000 d1fa90b4 d1fa9048 2e056fb7 > [ 1.187008] 00000002 ffffffff d1fb6dd0 00000000 d238b024 d346bb8c c18c26f0 d346bb98 > [ 1.187008] Call Trace: > [ 1.187008] [] ? acpi_platform_notify+0x19/0x78 > [ 1.187008] [] device_add+0x33a/0x530 > [ 1.187008] [] snd_seq_device_dev_register+0x10/0x20 > [ 1.187008] [] snd_device_register+0x46/0x80 > [ 1.187008] [] snd_rawmidi_dev_register+0x1cd/0x2d0 > [ 1.187008] [] ? snd_ctl_dev_register+0x2a/0x30 > [ 1.187008] [] snd_device_register_all+0x42/0x70 > [ 1.187008] [] snd_card_register+0x3d/0x150 > [ 1.187008] [] f_midi_bind+0x16a/0x6c0 > [ 1.187008] [] ? irq_exit+0x30/0x60 > [ 1.187008] [] ? console_unlock+0x38f/0x520 > [ 1.187008] [] ? vprintk_emit+0x28a/0x5f0 > [ 1.187008] [] ? dev_vprintk_emit+0x14f/0x280 > [ 1.187008] [] ? alloc_debug_processing+0xcb/0x150 > [ 1.187008] [] ? f_midi_alloc+0x92/0x1a0 > [ 1.187008] [] ? f_midi_alloc+0x92/0x1a0 > [ 1.187008] [] ? f_midi_alloc+0x92/0x1a0 > [ 1.187008] [] ? midi_bind+0xd2/0xd2 > [ 1.187008] [] ? dev_printk_emit+0x1a/0x20 > [ 1.187008] [] ? __dev_printk+0x46/0x90 > [ 1.187008] [] ? dev_printk+0x26/0x30 > [ 1.187008] [] usb_add_function+0x79/0x140 > [ 1.187008] [] ? midi_bind+0xd2/0xd2 > [ 1.187008] [] midi_bind_config+0x25/0x3c > [ 1.187008] [] usb_add_config+0x9c/0x240 > [ 1.187008] [] ? mutex_unlock+0x8/0x10 > [ 1.187008] [] midi_bind+0x98/0xd2 > [ 1.187008] [] composite_bind+0x88/0x1a0 > [ 1.187008] [] udc_bind_to_driver+0x4f/0xf0 > [ 1.187008] [] usb_gadget_probe_driver+0x6d/0xb0 > [ 1.187008] [] ? do_one_initcall+0x77/0x151 > [ 1.187008] [] usb_composite_probe+0x78/0xa0 > [ 1.187008] [] ? midimod_init+0xf/0xf > [ 1.187008] [] midi_driver_init+0xd/0xf > [ 1.187008] [] do_one_initcall+0xcd/0x151 > [ 1.187008] [] ? do_early_param+0x73/0x73 > [ 1.187008] [] ? parse_args+0x1f0/0x430 > [ 1.187008] [] kernel_init_freeable+0xe3/0x15b > [ 1.187008] [] kernel_init+0xb/0xe0 > [ 1.187008] [] ret_from_kernel_thread+0x21/0x30 > [ 1.187008] [] ? rest_init+0xb0/0xb0 > [ 1.187008] Code: b6 00 00 00 00 8b 57 14 8b 45 f0 e8 25 d9 ff ff 85 c0 89 c3 75 69 8b 45 f0 8b 48 2c 85 c9 74 6c 8b 45 f0 8d 70 08 8b 47 48 89 f2 <8b> 40 50 83 c0 28 e8 6f 34 bc ff 85 c0 89 c3 74 0d 8b 55 f0 8d > [ 1.187008] EIP: [] bus_add_device+0xd6/0x160 SS:ESP 0068:d346bb30 > [ 1.187008] CR2: 0000000000000050 > [ 1.187008] ---[ end trace 7c40b21b66beeff8 ]--- > [ 1.187008] Kernel panic - not syncing: Fatal exception This is yet another init order problem. Fixed by the patch below. Thanks! Takashi -- 8< -- From: Takashi Iwai Subject: [PATCH] ALSA: seq: Fix init order of snd_seq_device stuff When the sequencer driver is built in kernel, it may panic at boot because of the uninitialized snd_seq_bus_type. Initialize it properly via subsys_initcall() instead of module_init() to assure that the bus is registered beforehand. Reported-by: Fengguang Wu Fixes: 7c37ae5c625a ('ALSA: seq: Rewrite sequencer device binding with standard bus') Signed-off-by: Takashi Iwai --- sound/core/seq/seq_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 355b34269bd1..d99f99d61983 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c @@ -311,5 +311,5 @@ static void __exit alsa_seq_device_exit(void) bus_unregister(&snd_seq_bus_type); } -module_init(alsa_seq_device_init) +subsys_initcall(alsa_seq_device_init) module_exit(alsa_seq_device_exit)