Received: by 10.223.185.116 with SMTP id b49csp1055212wrg; Fri, 23 Feb 2018 11:05:25 -0800 (PST) X-Google-Smtp-Source: AH8x224akGhSjB9xhrSG79NcxaR3wGNM8XHYaFVJraA3imNizxRli4Cv04uqkm/g3eaX7wWgDQE6 X-Received: by 10.98.242.65 with SMTP id y1mr2664558pfl.232.1519412725195; Fri, 23 Feb 2018 11:05:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519412725; cv=none; d=google.com; s=arc-20160816; b=RXetOe2L5nxNkelx7ScEEqiKPyMDGFABXbjhY4kOiHSMGyW7crGSXtmYEVhCSvjGnA ati+IdhjtQ08R7RMRjr7fwYUSW3WXdXTKEw4hM6nkVjPhtANbFxja6TImaJWxrw1/HPA +6nPEt3W5FJiI80HOy3uUTV7rFh9pKePGtyoA50Y884QJtRlQ5EsUh8QdIUQoGrmr4wi hgObBqo8s1YlWCJJ2Flge+6mkWnz8yx/SW6GmV4R7269zrxSMUzNZ/r/cMGp3t4HU7SZ FPWKYLWk+RVqomRMJA4UXvsqj/dMWO/84Bsr0fBo8Z4yRexiPpz12hRLZLwrDmCLIuQ1 gK1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=IpnkShDaHW91BUgnT3yW36Ghee6BSjVFbnZPHJITC8E=; b=FDQEWSAjZsQK7QpLnfLm5EFBIpAt/gG3SsOI0RyMK+bCTTB131HJ8LPSQyZWpnSDza G6lzs6Znohg6rVeowOdofutTW6WSEw5iOm4yHLVGpZJL51U1ZocZFPiyzDrV5ZVIxIMp bSIy7QEqKxo+fPs0OvTklXsToogXj526Dpcv+NSoEUnFmvN8XqfMGG9DN/V+Qmp4WSbi yPt23Mc5Iin2zwxxLmCE9RhR/eqNejJRIqwyHy4QoVsT7DLpzxQa+kZu2rnw4QsDJIBq aPDaqSkMB1TNmM/UF4CgnFWFtPCEorNWjecIqawjeuX6XN/bMmUfPNeLjf41V19HEMFK 8KIw== 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 e71si1849942pgc.209.2018.02.23.11.05.10; Fri, 23 Feb 2018 11:05:25 -0800 (PST) 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 S935712AbeBWTCt (ORCPT + 99 others); Fri, 23 Feb 2018 14:02:49 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50652 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965634AbeBWS6l (ORCPT ); Fri, 23 Feb 2018 13:58:41 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AA89B114F; Fri, 23 Feb 2018 18:58:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengjun Xing , Mathias Nyman Subject: [PATCH 4.15 40/45] xhci: fix xhci debugfs errors in xhci_stop Date: Fri, 23 Feb 2018 19:29:19 +0100 Message-Id: <20180223170721.723267082@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170715.197760019@linuxfoundation.org> References: <20180223170715.197760019@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhengjun Xing commit 11cd764dc9a030991880ad4d51db93918afa5822 upstream. In function xhci_stop, xhci_debugfs_exit called before xhci_mem_cleanup. xhci_debugfs_exit removed the xhci debugfs root nodes, xhci_mem_cleanup called function xhci_free_virt_devices_depth_first which in turn called function xhci_debugfs_remove_slot. Function xhci_debugfs_remove_slot removed the nodes for devices, the nodes folders are sub folder of xhci debugfs. It is unreasonable to remove xhci debugfs root folder before xhci debugfs sub folder. Function xhci_mem_cleanup should be called before function xhci_debugfs_exit. Fixes: 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver") Cc: # v4.15 Signed-off-by: Zhengjun Xing Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -652,8 +652,6 @@ static void xhci_stop(struct usb_hcd *hc return; } - xhci_debugfs_exit(xhci); - spin_lock_irq(&xhci->lock); xhci->xhc_state |= XHCI_STATE_HALTED; xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; @@ -685,6 +683,7 @@ static void xhci_stop(struct usb_hcd *hc xhci_dbg_trace(xhci, trace_xhci_dbg_init, "cleaning up memory"); xhci_mem_cleanup(xhci); + xhci_debugfs_exit(xhci); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "xhci_stop completed - status = %x", readl(&xhci->op_regs->status));