[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7e8be5ff6e070dab40368a3c59dda21d1816c94.camel@mediatek.com>
Date: Wed, 11 Aug 2021 08:22:04 +0000
From: Chunfeng Yun (云春峰)
<Chunfeng.Yun@...iatek.com>
To: "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"ikjn@...omium.org" <ikjn@...omium.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"mathias.nyman@...el.com" <mathias.nyman@...el.com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
Subject: Re: [PATCH] usb: xhci-mtk: Do not use xhci's virt_dev in
drop_endpoint
Hi Ikjoon,
On Thu, 2021-08-05 at 13:37 +0800, Ikjoon Jang wrote:
> xhci-mtk depends on xhci's internal virt_dev when it retrieves its
> internal data from usb_host_endpoint both in add_endpoint and
> drop_endpoint callbacks. But when setup packet was retired by
> transaction errors in xhci_setup_device() path, a virt_dev for the
> slot
> is newly created with real_port 0. This leads to xhci-mtks's NULL
> pointer
> dereference from drop_endpoint callback as xhci-mtk assumes that
> virt_dev's
> real_port is always started from one. The similar problems were
> addressed
> by [1] but that can't cover the failure cases from setup_device.
>
> This patch drops the usages of xhci's virt_dev in xhci-mtk's
> drop_endpoint
> callback by adopting rhashtable for searching mtk's schedule entity
> from a given usb_host_endpoint pointer instead of searching a linked
> list.
> So mtk's drop_endpoint callback doesn't have to rely on virt_dev at
> all.
>
> [1]
> https://lore.kernel.org/r/1617179142-2681-2-git-send-email-chunfeng.yun@mediatek.com
>
> Signed-off-by: Ikjoon Jang <ikjn@...omium.org>
> ---
>
> drivers/usb/host/xhci-mtk-sch.c | 140 ++++++++++++++++++----------
> ----
> drivers/usb/host/xhci-mtk.h | 15 ++--
> 2 files changed, 86 insertions(+), 69 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-
> mtk-sch.c
> index cffcaf4dfa9f..f9b4d27ce449 100644
> --- a/drivers/usb/host/xhci-mtk-sch.c
> +++ b/drivers/usb/host/xhci-mtk-sch.c
> @@ -80,7 +80,7 @@ decode_ep(struct usb_host_endpoint *ep, enum
> usb_device_speed speed)
> interval /= 1000;
> }
> Please give me more time to look at this patch, and try to reproduce
> it, I'm busy with DVT test recently, thanks a lot
Powered by blists - more mailing lists