lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACPK8XdfgMg=n9gBaMe+8z3aV4ifAJ3rZP7oL6ME1wem70FQTQ@mail.gmail.com>
Date:   Wed, 31 Mar 2021 06:19:17 +0000
From:   Joel Stanley <joel@....id.au>
To:     Tao Ren <rentao.bupt@...il.com>
Cc:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andrew Jeffery <andrew@...id.au>,
        kernel test robot <lkp@...el.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Sasha Levin <sashal@...nel.org>,
        Julia Lawall <julia.lawall@...ia.fr>,
        Ryan Chen <ryan_chen@...eedtech.com>,
        Thomas Tai <thomas.tai@...cle.com>,
        Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Christoph Hellwig <hch@....de>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Robin Murphy <robin.murphy@....com>, linux-usb@...r.kernel.org,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-aspeed <linux-aspeed@...ts.ozlabs.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        OpenBMC Maillist <openbmc@...ts.ozlabs.org>,
        Tao Ren <taoren@...com>
Subject: Re: [PATCH] usb: gadget: aspeed: fix dma map failure

On Wed, 31 Mar 2021 at 05:02, <rentao.bupt@...il.com> wrote:
>
> From: Tao Ren <rentao.bupt@...il.com>
>
> Currently the virtual port_dev device is passed to DMA API, and this is
> wrong because the device passed to DMA API calls must be the actual
> hardware device performing the DMA.
>
> The patch replaces usb_gadget_map_request/usb_gadget_unmap_request APIs
> with usb_gadget_map_request_by_dev/usb_gadget_unmap_request_by_dev APIs
> so the DMA capable platform device can be passed to the DMA APIs.
>
> The patch fixes below backtrace detected on Facebook AST2500 OpenBMC
> platforms:
>
> [<80106550>] show_stack+0x20/0x24
> [<80106868>] dump_stack+0x28/0x30
> [<80823540>] __warn+0xfc/0x110
> [<8011ac30>] warn_slowpath_fmt+0xb0/0xc0
> [<8011ad44>] dma_map_page_attrs+0x24c/0x314
> [<8016a27c>] usb_gadget_map_request_by_dev+0x100/0x1e4
> [<805cedd8>] usb_gadget_map_request+0x1c/0x20
> [<805cefbc>] ast_vhub_epn_queue+0xa0/0x1d8
> [<7f02f710>] usb_ep_queue+0x48/0xc4
> [<805cd3e8>] ecm_do_notify+0xf8/0x248
> [<7f145920>] ecm_set_alt+0xc8/0x1d0
> [<7f145c34>] composite_setup+0x680/0x1d30
> [<7f00deb8>] ast_vhub_ep0_handle_setup+0xa4/0x1bc
> [<7f02ee94>] ast_vhub_dev_irq+0x58/0x84
> [<7f0309e0>] ast_vhub_irq+0xb0/0x1c8
> [<7f02e118>] __handle_irq_event_percpu+0x50/0x19c
> [<8015e5bc>] handle_irq_event_percpu+0x38/0x8c
> [<8015e758>] handle_irq_event+0x38/0x4c
>
> Signed-off-by: Tao Ren <rentao.bupt@...il.com>

Fixes: 7ecca2a4080c ("usb/gadget: Add driver for Aspeed SoC virtual hub")
Reviewed-by: Joel Stanley <joel@....id.au>

Thanks Tao!

> ---
>  drivers/usb/gadget/udc/aspeed-vhub/core.c | 3 ++-
>  drivers/usb/gadget/udc/aspeed-vhub/epn.c  | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> index be7bb64e3594..d11d3d14313f 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> @@ -36,6 +36,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
>                    int status)
>  {
>         bool internal = req->internal;
> +       struct ast_vhub *vhub = ep->vhub;
>
>         EPVDBG(ep, "completing request @%p, status %d\n", req, status);
>
> @@ -46,7 +47,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
>
>         if (req->req.dma) {
>                 if (!WARN_ON(!ep->dev))
> -                       usb_gadget_unmap_request(&ep->dev->gadget,
> +                       usb_gadget_unmap_request_by_dev(&vhub->pdev->dev,
>                                                  &req->req, ep->epn.is_in);
>                 req->req.dma = 0;
>         }
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
> index 02d8bfae58fb..cb164c615e6f 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
> @@ -376,7 +376,7 @@ static int ast_vhub_epn_queue(struct usb_ep* u_ep, struct usb_request *u_req,
>         if (ep->epn.desc_mode ||
>             ((((unsigned long)u_req->buf & 7) == 0) &&
>              (ep->epn.is_in || !(u_req->length & (u_ep->maxpacket - 1))))) {
> -               rc = usb_gadget_map_request(&ep->dev->gadget, u_req,
> +               rc = usb_gadget_map_request_by_dev(&vhub->pdev->dev, u_req,
>                                             ep->epn.is_in);
>                 if (rc) {
>                         dev_warn(&vhub->pdev->dev,
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ