diff mbox series

[09/10] xhci: don't create endpoint debugfs entry before ring buffer is set.

Message ID 20200918131752.16488-10-mathias.nyman@linux.intel.com
State New
Headers show
Series xhci features for usb-next | expand

Commit Message

Mathias Nyman Sept. 18, 2020, 1:17 p.m. UTC
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")
Cc: stable@vger.kernel.org #v4.19+
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
 drivers/usb/host/xhci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


Sasha Levin Sept. 21, 2020, 12:54 p.m. UTC | #1

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver").

The bot has tested the following trees: v5.8.10, v5.4.66, v4.19.146.

v5.8.10: Build OK!
v5.4.66: Build OK!
v4.19.146: Failed to apply! Possible dependencies:
    5afa0a5ed3da ("usb: xhci: add endpoint context tracing when an endpoint is added")

NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?
diff mbox series


diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 4cfb95104c26..e88f4f953995 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1918,8 +1918,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);
-	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,
@@ -2952,6 +2950,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);