Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp259661pxx; Wed, 28 Oct 2020 04:20:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAH7qDK5q0dT0Kn0XyTcpAX+revaeaJC7WgnusZ1/Ot2j8vBEwktgfXNK/ZZGS4elTwEYF X-Received: by 2002:a17:906:8891:: with SMTP id ak17mr6931178ejc.176.1603884048139; Wed, 28 Oct 2020 04:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603884048; cv=none; d=google.com; s=arc-20160816; b=NUqDboOKMNcik2gwLciYHlRHfohi72OhmtDGCU3HmrfD65MkP2+p0x8QQhopo67ZPK jf0n/kuiEd6CmAEqX56EptCRJlpvEelLR9tvHYjXTk/1gXhhwBJZgcr+kYeKTz1TJqt8 MKDEe05ZaO0wda2/Nbl6vT/rYw4XWrTT4Hle40WA1PHe5TU2Coi4ulGYCSi3JNrEnWpu 9XjClUYHMebkMjNXLGrdc9bLRZnvo94ZoocjMCq9Qdq3WJvWCNdNk8PUHZ15ESraOweq SWb4JX2SD2DQJNJyzv4uewCNaylXjL4lsuRk/uCK3VQeC+EY7dFIM45rjU6kVGv80Aux kKxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZaEqkjLA5umaMevyW1XIwX0BHRLiMpY04MdWa03safA=; b=artX64ZBRd4a3bedegCJVORM2CJrbEH08K6Xd/tZxdvLl42cWMBQEBidiF/GWQPCC7 oinFQGClfLDilb15rfnp+cip5RSQwLnrwS2dYYpjKorQWSUIOG2o03soOlwnUWSGyiM8 ngfmZg7g7oETjC1Cn/Wz/ZWlNRZdGz4V5FYw21/mtSUwjUG1M81jvxWT9fw4ciIy+8YM 6XMDA6nC1q7FjqXW/pKqShYkUTEsMtaOxnlrecC/Ldwz3zuDX+nhzE4K2KW3lKNFQyxt xszdkXvCP862dhPo3qssooJk8q9DL4z9+aLY3+3j/FkJXov0evkHkiPYQ06JuZE1gCrM Y23A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TMoTMpd4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si3402013edu.343.2020.10.28.04.20.26; Wed, 28 Oct 2020 04:20:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TMoTMpd4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1789388AbgJ0PCG (ORCPT + 99 others); Tue, 27 Oct 2020 11:02:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:60312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1783999AbgJ0O6s (ORCPT ); Tue, 27 Oct 2020 10:58:48 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 779A921527; Tue, 27 Oct 2020 14:58:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810728; bh=FATNVHPm99rro3GZKMTnOMG8Mf/AxyHQl51ekFCM3vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMoTMpd4ozuuRC/ZkutY2ylWI9uhYenkzz7FCujJ/ErO+LR40aPcVd7k62Msk4tK8 RSui2GpFkXiUNgcYBZs+fp+RxWWSkQUFdVsVKp7pBxSpOj9R0X8pyBhx2hJhXlQjd6 Oh4yavjPc+vrold/XruY9E/S3xPctaulO2KKLkaM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman , Sasha Levin Subject: [PATCH 5.8 241/633] xhci: dont create endpoint debugfs entry before ring buffer is set. Date: Tue, 27 Oct 2020 14:49:44 +0100 Message-Id: <20201027135533.979231528@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathias Nyman [ Upstream commit 167657a1bb5fcde53ac304ce6c564bd90a2f9185 ] Make sure xHC completes the configure endpoint command and xhci driver sets the ring pointers correctly before we create the user readable debugfs file. In theory there was a small gap where a user could have read the debugfs file and cause a NULL pointer dereference error as ring pointer was not yet set, in practise we want this change to simplify the upcoming streams debugfs support. Fixes: 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver") Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20200918131752.16488-10-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 113ab5d3cbfe5..f665da34a8f73 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1915,8 +1915,6 @@ static int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); trace_xhci_add_endpoint(ep_ctx); - xhci_debugfs_create_endpoint(xhci, virt_dev, ep_index); - xhci_dbg(xhci, "add ep 0x%x, slot id %d, new drop flags = %#x, new add flags = %#x\n", (unsigned int) ep->desc.bEndpointAddress, udev->slot_id, @@ -2949,6 +2947,7 @@ static int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) xhci_check_bw_drop_ep_streams(xhci, virt_dev, i); virt_dev->eps[i].ring = virt_dev->eps[i].new_ring; virt_dev->eps[i].new_ring = NULL; + xhci_debugfs_create_endpoint(xhci, virt_dev, i); } command_cleanup: kfree(command->completion); -- 2.25.1