Re: [PATCH for 4.14] xhci: add xhci_get_virt_ep() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 26, 2021 at 09:11:30AM +0000, Schmid, Carsten wrote:
> From 804d2db49c8db94ff4652f13826a2c74dac33941 Mon Sep 17 00:00:00 2001
> From: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
> Date: Fri, 29 Jan 2021 15:00:22 +0200
> Subject: [PATCH] xhci: add xhci_get_virt_ep() helper
> 
> [commit b1adc42d440df3233255e313a45ab7e9b2b74096 upstream]
> 
> In several event handlers we need to find the right endpoint
> structure from slot_id and ep_index in the event.
> 
> Add a helper for this, check that slot_id and ep_index are valid.
> 
> Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
> Link: https://lore.kernel.org/r/20210129130044.206855-6-mathias.nyman@xxxxxxxxxxxxxxx
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Carsten Schmid <carsten_schmid@xxxxxxxxxx>
> ---
> Rationale:
> From mail thread " Possible race in 4.14 xhci stack"
> Searched for fix that Mathias Nyman mentioned.
> Fix didn't apply on 4.14 directly, needed some small adaption.
> Result provided here.
> @Greg: Patch is for 4.14, not tested if applies on other kernels.
> ---
>  drivers/usb/host/xhci-ring.c | 58 ++++++++++++++++++++++++++++--------
>  drivers/usb/host/xhci.h      |  3 +-
>  2 files changed, 47 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 9828c1eff9a5..ce5deac93418 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -444,6 +444,26 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci,
>  }
>  }
> 
> +static struct xhci_virt_ep *xhci_get_virt_ep(struct xhci_hcd *xhci,
> +     unsigned int slot_id,
> +     unsigned int ep_index)
> +{
> +if (slot_id == 0 || slot_id >= MAX_HC_SLOTS) {
> +xhci_warn(xhci, "Invalid slot_id %u\n", slot_id);
> +return NULL;
> +}
> +if (ep_index >= EP_CTX_PER_DEV) {
> +xhci_warn(xhci, "Invalid endpoint index %u\n", ep_index);
> +return NULL;
> +}
> +if (!xhci->devs[slot_id]) {
> +xhci_warn(xhci, "No xhci virt device for slot_id %u\n", slot_id);
> +return NULL;
> +}
> +
> +return &xhci->devs[slot_id]->eps[ep_index];
> +}
> +

Also, the patch is corrupted and can not be applied, even if I wanted to
:(

So can you fix that up when you resend all of the other versions too?

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux