Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2260736ybe; Tue, 3 Sep 2019 10:09:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyknVoylYJGStsqRulyeqYsRuB0LBemNssydsVSxGitfuFfEs+Cx/tNTgkj54Y7u1uuOUkm X-Received: by 2002:a63:20d:: with SMTP id 13mr31831046pgc.253.1567530547004; Tue, 03 Sep 2019 10:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567530546; cv=none; d=google.com; s=arc-20160816; b=fX5Pb2beMhQlF7cjEpg1y76fcV9bXWyu906UATvOLOWjGqPxmy4qJTL2Tfc43VEiRy CFvNDr6bIxvCi4TKth4vHX14B5eRKxZsG7NpF9zVpqW7q7VnPpK00LkY9AwfrJriEXbh osKzI0KE9hm2Dfb58qQU07t8Qr+WGIyocvcT/upQdv2vpBBbDYsei9WwoSBTYaZleUIT 6eZPVRw+c4G3UxQZjSrK/9D98nAv4Y4sDWYQcU388VvRHyyLhBb40kCrFSpMBKiVZmft EWfaAz3vYoxlXwNkHqwyTdcOM8TE88b6BeJ+H59MKsjpKVLzewjfZtheyqEVQZUBTCu7 8Eng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=8/GpIBjRs8Z+TC8lt2aGne8KqTaxTzdoKqLNeS9sLV8=; b=TtzAGIrmFfjxUilD+d+qlmK/0wMWAdSTl1GCUOQtklctYfFEOcuy/wtfhTDOwHRuHi PdxABgiSgufpJ82ICkYWc36a5ezu3F5KtevpweYOZyr+TdUqGg3lcZ380f4G1XMA4swF YkHAI4/O53M/mmrx3XJPSm7tULE1BssabFzT2OylklzygcOauuLwM3eWiY0ig7Dms3RZ oRx5soaogy+8nWsE49n6Kh06rU5TvvzFDMqqHP1CtMT82CyqI1BEV22KKMEid1X3EPTU Ye188Lz3bvjPfJW1NknQV/KRVUhiac384ZcYoYbzu8EqFjHAYJoRYDtwzAKtVMf50UMR YVbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si15483287pgv.90.2019.09.03.10.08.45; Tue, 03 Sep 2019 10:09:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730201AbfICRGJ (ORCPT + 99 others); Tue, 3 Sep 2019 13:06:09 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:32892 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1730135AbfICRGI (ORCPT ); Tue, 3 Sep 2019 13:06:08 -0400 Received: (qmail 4903 invoked by uid 2102); 3 Sep 2019 13:06:07 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Sep 2019 13:06:07 -0400 Date: Tue, 3 Sep 2019 13:06:07 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: David Howells cc: Guenter Roeck , , Casey Schaufler , Stephen Smalley , Greg Kroah-Hartman , , , Christian Brauner , , , , , , , Subject: Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7] In-Reply-To: <29419.1567528161@warthog.procyon.org.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Sep 2019, David Howells wrote: > Guenter Roeck wrote: > > > > > This added call to usbdev_remove() results in a crash when running > > > > the qemu "tosa" emulation. Removing the call fixes the problem. > > > > > > Yeah - I'm going to drop the bus notification messages for now. > > > > > It is not the bus notification itself causing problems. It is the > > call to usbdev_remove(). > > Unfortunately, I don't know how to fix it and don't have much time to > investigate it right now - and it's something that can be added back later. The cause of your problem is quite simple: static int usbdev_notify(struct notifier_block *self, unsigned long action, void *dev) { switch (action) { case USB_DEVICE_ADD: + post_usb_device_notification(dev, NOTIFY_USB_DEVICE_ADD, 0); break; case USB_DEVICE_REMOVE: + post_usb_device_notification(dev, NOTIFY_USB_DEVICE_REMOVE, 0); + usbdev_remove(dev); + break; + case USB_BUS_ADD: + post_usb_bus_notification(dev, NOTIFY_USB_BUS_ADD, 0); + break; + case USB_BUS_REMOVE: + post_usb_bus_notification(dev, NOTIFY_USB_BUS_REMOVE, 0); usbdev_remove(dev); break; } The original code had usbdev_remove(dev) under the USB_DEVICE_REMOVE case. The patch mistakenly moves it, putting it under the USB_BUS_REMOVE case. If the usbdev_remove() call were left where it was originally, the problem would be solved. Alan Stern