From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752337AbaA2VT6 (ORCPT ); Wed, 29 Jan 2014 16:19:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33830 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751853AbaA2VT4 (ORCPT ); Wed, 29 Jan 2014 16:19:56 -0500 Date: Wed, 29 Jan 2014 13:21:10 -0800 From: Greg Kroah-Hartman To: Fabio Estevam Cc: Tejun Heo , Alan Stern , Denis Kirjanov , linux-kernel , USB list Subject: Re: [PATCH driver-core-linus] kernfs: make kernfs_deactivate() honor KERNFS_LOCKDEP flag Message-ID: <20140129212110.GD9095@kroah.com> References: <20140129170403.GJ30842@htj.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 29, 2014 at 03:19:51PM -0200, Fabio Estevam wrote: > On Wed, Jan 29, 2014 at 3:04 PM, Tejun Heo wrote: > > kernfs_deactivate() forgot to check whether KERNFS_LOCKDEP is set > > before performing lockdep annotations and ends up feeding > > uninitialized lockdep_map to lockdep triggering warning like the > > following on USB stick hotunplug. > > > > usb 1-2: USB disconnect, device number 2 > > INFO: trying to register non-static key. > > the code is fine but needs lockdep annotation. > > turning off the locking correctness validator. > > CPU: 1 PID: 62 Comm: khubd Not tainted 3.13.0-work+ #82 > > Hardware name: empty empty/S3992, BIOS 080011 10/26/2007 > > ffff880065ca7f60 ffff88013a4ffa08 ffffffff81cfb6bd 0000000000000002 > > ffff88013a4ffac8 ffffffff810f8530 ffff88013a4fc710 0000000000000002 > > ffff880100000000 ffffffff82a3db50 0000000000000001 ffff88013a4fc710 > > Call Trace: > > [] dump_stack+0x4e/0x7a > > [] __lock_acquire+0x1910/0x1e70 > > [] lock_acquire+0x9a/0x1d0 > > [] kernfs_deactivate+0xee/0x130 > > [] kernfs_addrm_finish+0x38/0x60 > > [] kernfs_remove_by_name_ns+0x51/0xa0 > > [] remove_files.isra.1+0x41/0x80 > > [] sysfs_remove_group+0x47/0xa0 > > [] sysfs_remove_groups+0x33/0x50 > > [] device_remove_attrs+0x4d/0x80 > > [] device_del+0x12e/0x1d0 > > [] usb_disconnect+0x122/0x1a0 > > [] hub_thread+0x3c5/0x1290 > > [] kthread+0xed/0x110 > > [] ret_from_fork+0x7c/0xb0 > > > > Fix it by making kernfs_deactivate() perform lockdep annotations only > > if KERNFS_LOCKDEP is set. > > > > Signed-off-by: Tejun Heo > > Reported-by: Fabio Estevam > > Reported-by: Alan Stern > > Thanks, Tejun. I don't get the warning after removing the USB stick > after applying this patch: > > Tested-by: Fabio Estevam Great, I'll queue this up and get it to Linus after 3.14-rc1 is out. thanks, greg k-h