Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761539Ab2FEJio (ORCPT ); Tue, 5 Jun 2012 05:38:44 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:52789 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758120Ab2FEJim convert rfc822-to-8bit (ORCPT ); Tue, 5 Jun 2012 05:38:42 -0400 MIME-Version: 1.0 In-Reply-To: <20120605091858.GA20917@kroah.com> References: <1338886747-28088-1-git-send-email-ming.lei@canonical.com> <20120605091858.GA20917@kroah.com> Date: Tue, 5 Jun 2012 17:38:39 +0800 Message-ID: Subject: Re: [PATCH] driver core: fix shutdown races with probe/remove From: Ming Lei To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Alan Stern , Paul McKenney Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1442 Lines: 47 Hi, On Tue, Jun 5, 2012 at 5:18 PM, Greg Kroah-Hartman wrote: > On Tue, Jun 05, 2012 at 04:59:07PM +0800, Ming Lei wrote: >> Firstly, .shutdown callback may touch a uninitialized hardware >> if dev->driver is set and .probe is not completed. > > When would that ever happen? It may happen when someone plugs a device, then run 'shutdown' immediately. > >> Secondly, device_shutdown() may dereference a null pointer to cause >> oops when dev->driver is cleared after it is checked in device_shutdown(). > > Again, when would that happen? ?A new device/driver being added to the > system as it is being shutdown? It is usually that someone presses 'power off' button and unplugs its usb devices or pci/e devices, maybe together with a new plug. In such case, the oops may be triggered. > > Has anyone ever hit that before? Looks someone has reported it, I also can trigger it with some delay added in device_shutdown. > > Is this really needed? In case that it is triggered, oops will prevent system from being shutdown, and it should be a big problem. IMO, we can avoid it without much change and side effect, so looks worthy the change. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/