Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp523460pxx; Wed, 28 Oct 2020 10:15:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+ZPW0HCQwOsvCAGljBC3rdkPGQFlO/Q/9yxxp0ybGnQR7SOEG1uwueGYhHJqm7cJpdvTF X-Received: by 2002:aa7:c6c5:: with SMTP id b5mr9218421eds.259.1603905301998; Wed, 28 Oct 2020 10:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603905301; cv=none; d=google.com; s=arc-20160816; b=pUTAIoXMrhw/MzwhDaUoXjjX2rSEjfEW0x48DPuwSew31VRtNo+Eyq2wDBb9yeV/g7 sb6/M9xvsUC9DMwtoxXR5UgcQMUb1+LLr2V0I7U6AZDw1iD/PjD7Y8vg40HQEHOg6z3X jXd4dBxuQWVbKIWlCgue9a1RZQmOL4/5bGLstG2h8aqdItWNgMKIjGSGLfKirhEc65Yk +EK2RI0KWClOcB8L3ZQDM2g4MW78AvZnUojRzarPjIy2J8BBKiShclffhOpfQiOydD2E ylblexvy76jWRDXNAxzsyR+JLKgGz/cYnGT3N+sAfF2RSvN+wbXuS0Nu66+WY9djFxdf qNHw== 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=P5RLpzkyc+EcsMEXAdMVO7o5T0lmdeHNXWKDPNekNHQ=; b=mMyB66Fj8abwsj6aKUIxJchJnp89oPpS16VAJ9AEzgiW2rCLESeVEWW+O97Dhgz4Ir ouHO9AB7eJQ/CmUHq4Kez2NcmC9MV2+n/6dtsEbhYoN1Tm5jcGJPh4kq462uC0zN+DOJ fcuoxcedC5djDzfNkR7+TuZlf2ALfqtmCcM+nTaTHNnkKcT6ZQ2QYskKpLlujhuJ0L99 P17aWkdenvDg7KXhsDqBWfSXYWxGmqGn99KC1XRS5t+XOpAyuotvUY8GlqWMPYr6xpKk yTm7fh3Xnt8tyW1niU9QEf0rYvKir1YDFBvMaYEMXuX6iv2WpfKJf9uo3ENUdt2WYRpF 0mhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xeox2+fO; 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 z17si3710274ejc.499.2020.10.28.10.14.39; Wed, 28 Oct 2020 10:15:01 -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=xeox2+fO; 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 S1820569AbgJ0RgI (ORCPT + 99 others); Tue, 27 Oct 2020 13:36:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:35606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760838AbgJ0Ogl (ORCPT ); Tue, 27 Oct 2020 10:36:41 -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 E262022202; Tue, 27 Oct 2020 14:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809400; bh=Pe5YbfDqRYtws1UY41+F+jcJs3m1MgzoSq8p/FmeSNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xeox2+fO0Vp/bFHmBkoWAnTaWVWxkDgxPZq/43WDsD4QLBVecNsVB/ndP15xsM6qq d1yT8wy6MEaN9ALCJ0uTGEgMXCn89HoxHiX8EiU4NSFAbmzk/apctGI0Madm4Vwv/9 7Oya9U/4DrvPLiUAoSTJhXlwNOiZy3q2+yxSWzQ8= 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.4 151/408] xhci: dont create endpoint debugfs entry before ring buffer is set. Date: Tue, 27 Oct 2020 14:51:29 +0100 Message-Id: <20201027135502.101268526@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 bad154f446f8d..0d10ede581cbd 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