Return-Path: Received: from mga07.intel.com ([134.134.136.100]:60157 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752863AbdLDJOC (ORCPT ); Mon, 4 Dec 2017 04:14:02 -0500 Subject: Re: [PATCH 2/2] usb: xhci: fix panic in xhci_free_virt_devices_depth_first To: Greg Kroah-Hartman , Guenter Roeck Cc: linux-usb@vger.kernel.org, Yu Chen , "# v4 . 10+" , Fan Ning , Li Rui , yangdi References: <1512128480-11230-1-git-send-email-mathias.nyman@linux.intel.com> <1512128480-11230-3-git-send-email-mathias.nyman@linux.intel.com> <20171201152340.GA10834@kroah.com> From: Mathias Nyman Message-ID: <166c4320-7b68-1d8a-ddf5-beea53cf452a@linux.intel.com> Date: Mon, 4 Dec 2017 11:16:29 +0200 MIME-Version: 1.0 In-Reply-To: <20171201152340.GA10834@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 01.12.2017 17:23, Greg Kroah-Hartman wrote: > On Fri, Dec 01, 2017 at 06:38:16AM -0800, Guenter Roeck wrote: >> On Fri, Dec 1, 2017 at 3:41 AM, Mathias Nyman >> wrote: >>> From: Yu Chen >>> >>> Check vdev->real_port 0 to avoid panic >>> [ 9.261347] [] xhci_free_virt_devices_depth_first+0x58/0x108 >>> [ 9.261352] [] xhci_mem_cleanup+0x1bc/0x570 >>> [ 9.261355] [] xhci_stop+0x140/0x1c8 >>> [ 9.261365] [] usb_remove_hcd+0xfc/0x1d0 >>> [ 9.261369] [] xhci_plat_remove+0x6c/0xa8 >>> [ 9.261377] [] platform_drv_remove+0x2c/0x70 >>> [ 9.261384] [] __device_release_driver+0x80/0x108 >>> [ 9.261387] [] device_release_driver+0x2c/0x40 >>> [ 9.261392] [] bus_remove_device+0xe0/0x120 >>> [ 9.261396] [] device_del+0x114/0x210 >>> [ 9.261399] [] platform_device_del+0x30/0xa0 >>> [ 9.261403] [] dwc3_otg_work+0x204/0x488 >>> [ 9.261407] [] event_work+0x304/0x5b8 >>> [ 9.261414] [] process_one_work+0x148/0x490 >>> [ 9.261417] [] worker_thread+0x50/0x4a0 >>> [ 9.261421] [] kthread+0xe8/0x100 >>> [ 9.261427] [] ret_from_fork+0x10/0x50 >>> >>> The problem can occur if xhci_plat_remove() is called shortly after >>> xhci_plat_probe(). While xhci_free_virt_devices_depth_first been >>> called before the device has been setup and get real_port initialized. >>> The problem occurred on Hikey960 and was reproduced by Guenter Roeck >>> on Kevin with chromeos-4.4. >>> >>> Cc: Guenter Roeck >>> Cc: # v4.10+ >> >> Fixes: ee8665e28e8d ("xhci: free xhci virtual devices with leaf nodes first") >> >> would probably be better. That patch is in v4.4.y as well as in >> v4.9.y, and thus both releases are affected. > > I've added this fixes line, thanks. > Thanks -Mathias