From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com ([192.55.52.120]:24109 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965001AbcKWOnW (ORCPT ); Wed, 23 Nov 2016 09:43:22 -0500 Subject: Re: [RFT PATCH 1/1] xhci: free xhci virtual devices with leaf nodes first To: Guenter Roeck References: <582DC88C.5040308@linux.intel.com> <1479903867-561-1-git-send-email-mathias.nyman@linux.intel.com> Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org From: Mathias Nyman Message-ID: <5835AB33.4050701@linux.intel.com> Date: Wed, 23 Nov 2016 16:44:03 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 23.11.2016 15:32, Guenter Roeck wrote: > On 11/23/2016 04:24 AM, Mathias Nyman wrote: >> the tt_info provided by a HS hub might be in use to by a child device >> Make sure we free the devices in the correct order. >> >> This is needed in special cases such as when xhci controller is >> reset when resuming from hibernate, and all virt_devices are freed. >> >> Also free the virt_devices starting from max slot_id as children >> more commonly have higher slot_id than parent. >> >> CC: >> Signed-off-by: Mathias Nyman >> >> --- >> >> Guenter Roeck, does this work for you? >> >> A rework of how tt_info is stored and used might be needed, >> but that will take some time and won't go to stable as easily. > > I'll give it a try. One concern, though: xhci_free_virt_device() is called > from multiple places, and does not always remove all devices. Is it save > to assume that all other callers remove children first ? > This should be the only place that xhci does a massive xhci_free_virt_device(), In the other places it's initiated per device by usb core which should handle child-parent relationships, or then just error paths when failing to allocate a device in the first place (no children yet) -Mathias