Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2273077ybe; Tue, 3 Sep 2019 10:19:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtt6mGQYOHJ9QCgQWpatOrENcKgVEQi6EZGB1VoXXFnp34oQYLtcmLPZJ1bKsqbFGu/Tg8 X-Received: by 2002:a17:902:968e:: with SMTP id n14mr36380371plp.312.1567531178451; Tue, 03 Sep 2019 10:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567531178; cv=none; d=google.com; s=arc-20160816; b=njpQ0HeKlnJDlQaYxJSYJwEN5uj78OeaDZg0SY2qUE5j4gy6aV3fiRVq6JxTCBTySx K/2iC04kYvwcw9IBLxqWdBPsYBcGI8jyR2gFo2MZFyM43mq/bu7Xj9HD9tVvPQZrsjUo 56+yGc6omViihAEqJCmk4RiZOzwNQ7NNWHvOKrYIMt9QmUyEbRxoPjqGvhfPruJEOXim 9nBIr3TFf2ogD5kIXGJYVEVmTiHFT9LEdbvYt4yYEN6n7rIoZaB6AgLxYSbArjzP4DyG 94xKekTcdSfi9y1oDMGLRcXgqv5o27Meg6+3dU8fF25FAklGQApHL3JFAasVqhtsWz3D Lmgw== 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=lwYA58RxpIQMCzgDLQkFm/4UIKI2nWseVcHoX/ekIa0=; b=Uft1cSYCo+EZkHndTxsw9hwFxIuVDdTqPAPvBG2d2m7IJYXWxAeGVbQqHzWfS2jUh3 kd2PRYUrxYCy+tyySTxATyV7/GdXKMWGr3Q7Exe9sJcZJQJwjQe6kSdZuMyOwqA7qskO wm0BPXPym/oiSoRnWHUlBVjb0HrAnMrxYeGVs+w/+aXVREvdB+gifJB3U6XabPpJtlIR pXWq1IOvo1q6zNrKdHmQy8b/amHYnq+lf+mE2GEDoCk68M7JxOQWkJxnmOSDIkBdxcaT Ml5f4Krkxf0hQulrdkxHz8eF+xaJ2KK0abiyrhHpM7L2Cg8ZHbsalzDMTteFSlro+qFX KvcQ== 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 o5si15385539plh.382.2019.09.03.10.19.22; Tue, 03 Sep 2019 10:19:38 -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 S1730234AbfICRRI (ORCPT + 99 others); Tue, 3 Sep 2019 13:17:08 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:33032 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1730202AbfICRRI (ORCPT ); Tue, 3 Sep 2019 13:17:08 -0400 Received: (qmail 5101 invoked by uid 2102); 3 Sep 2019 13:17:07 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Sep 2019 13:17:07 -0400 Date: Tue, 3 Sep 2019 13:17: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: 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, Alan Stern wrote: > 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 ------------------------------^^^^^ Sorry, I should have said "duplicates" it. Alan Stern > USB_BUS_REMOVE case. > > If the usbdev_remove() call were left where it was originally, the > problem would be solved. > > Alan Stern