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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Mar 2021 12:03:03 +0000
From:   Robin Murphy <robin.murphy@....com>
To:     rentao.bupt@...il.com, Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Joel Stanley <joel@....id.au>,
        Andrew Jeffery <andrew@...id.au>,
        kernel test robot <lkp@...el.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Sasha Levin <sashal@...nel.org>,
        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>,
        linux-usb@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-aspeed@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
        openbmc@...ts.ozlabs.org, Tao Ren <taoren@...com>
Subject: Re: [PATCH] usb: gadget: aspeed: set port_dev dma mask

On 2021-03-26 07:02, rentao.bupt@...il.com wrote:
> From: Tao Ren <rentao.bupt@...il.com>
> 
> Set aspeed-usb vhub port_dev's dma mask to pass the dma_mask test in
> "dma_map_page_attrs" function, and the dma_mask test was added in
> 'commit f959dcd6ddfd ("dma-direct: Fix potential NULL pointer
> dereference")'.
> 
> Below is the backtrace without the patch:
> [<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>
> ---
>   drivers/usb/gadget/udc/aspeed-vhub/dev.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/dev.c b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
> index d268306a7bfe..9eb3904a6ff9 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/dev.c
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
> @@ -569,6 +569,7 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx)
>   	device_initialize(d->port_dev);
>   	d->port_dev->release = ast_vhub_dev_release;
>   	d->port_dev->parent = parent;
> +	d->port_dev->dma_mask = parent->dma_mask;

This might happen to work out, but is far from correct. Just wait until 
you try it on a platform where the USB controller is behind an IOMMU...

It looks like something is more fundamentally wrong here - the device 
passed to DMA API calls must be the actual hardware device performing 
the DMA, which in USB-land I believe means the controller's sysdev.

Robin.

>   	dev_set_name(d->port_dev, "%s:p%d", dev_name(parent), idx + 1);
>   	rc = device_add(d->port_dev);
>   	if (rc)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ