next take at setting up a dma mask by default for platform devices

2019-08-11 Thread Christoph Hellwig
Hi all, this is another attempt to make sure the dma_mask pointer is always initialized for platform devices. Not doing so lead to lots of boilerplate code, and makes platform devices different from all our major busses like PCI where we always set up a dma_mask. In the long run this should also

[PATCH 6/6] driver core: initialize a default DMA mask for platform device

2019-08-11 Thread Christoph Hellwig
We still treat devices without a DMA mask as defaulting to 32-bits for both mask, but a few releases ago we've started warning about such cases, as they require special cases to work around this sloppyness. Add a dma_mask field to struct platform_object so that we can initialize the dma_mask pointe

[PATCH 1/6] usb: don't create dma pools for HCDs with a localmem_pool

2019-08-11 Thread Christoph Hellwig
If the HCD provides a localmem pool we will never use the DMA pools, so don't create them. Fixes: b0310c2f09bb ("USB: use genalloc for USB HCs with local memory") Signed-off-by: Christoph Hellwig --- drivers/usb/core/buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --gi

[PATCH 2/6] usb: add a hcd_uses_dma helper

2019-08-11 Thread Christoph Hellwig
The USB buffer allocation code is the only place in the usb core (and in fact the whole kernel) that uses is_device_dma_capable, while the URB mapping code uses the uses_dma flag in struct usb_bus. Switch the buffer allocation to use the uses_dma flag used by the rest of the USB code, and create a

[PATCH 3/6] usb: add a HCD_DMA flag instead of guestimating DMA capabilities

2019-08-11 Thread Christoph Hellwig
The usb core is the only major place in the kernel that checks for a non-NULL device dma_mask to see if a device is DMA capable. This is generally a bad idea, as all major busses always set up a DMA mask, even if the device is not DMA capable - in fact bus layers like PCI can't even know if a devi

[PATCH 5/6] dma-mapping: remove is_device_dma_capable

2019-08-11 Thread Christoph Hellwig
No users left. Signed-off-by: Christoph Hellwig --- include/linux/dma-mapping.h | 5 - 1 file changed, 5 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index f7d1eea32c78..14702e2d6fa8 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapp

[PATCH 4/6] usb/max3421: remove the dummy {un,}map_urb_for_dma methods

2019-08-11 Thread Christoph Hellwig
Now that we have an explicit HCD_DMA flag, there is not need to override these methods. Signed-off-by: Christoph Hellwig --- drivers/usb/host/max3421-hcd.c | 17 - 1 file changed, 17 deletions(-) diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c index

[PATCH] xhci: fix memleak on setup address fails.

2019-08-11 Thread Ikjoon Jang
Xhci re-enables a slot on transaction error in set_address using xhci_disable_slot() + xhci_alloc_dev(). But in this case, xhci_alloc_dev() creates debugfs entries upon an existing device without cleaning up old entries, thus memory leaks. So this patch simply moves calling xhci_debugfs_free_dev(

RE: [PATCH v10 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

2019-08-11 Thread Pawel Laszczak
Hi, > >On 21/07/2019 21:32, Pawel Laszczak wrote: >> This patch introduce new Cadence USBSS DRD driver to Linux kernel. >> >> The Cadence USBSS DRD Controller is a highly configurable IP Core which >> can be instantiated as Dual-Role Device (DRD), Peripheral Only and >> Host Only (XHCI)configurati

Re: KASAN: slab-out-of-bounds Read in hidraw_ioctl

2019-08-11 Thread syzbot
syzbot has found a reproducer for the following crash on: HEAD commit:e96407b4 usb-fuzzer: main usb gadget fuzzer driver git tree: https://github.com/google/kasan.git usb-fuzzer console output: https://syzkaller.appspot.com/x/log.txt?x=150426ba60 kernel config: https://syzkaller.ap

RE: [PATCH v9 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

2019-08-11 Thread Peter Chen
> > Yes, driver frees not used buffers here. > I think that it's the safest place for this purpose. > > > > +dma_free_coherent(priv_dev->sysdev, buf- > >size, > + buf->buf, > +

RE: [EXT] Re: [PATCH v1] usb: dwc3: remove the call trace of USBx_GFLADJ

2019-08-11 Thread Yinbo Zhu
> -Original Message- > From: Felipe Balbi [mailto:ba...@kernel.org] > Sent: 2019年8月8日 13:07 > To: Yinbo Zhu ; Greg Kroah-Hartman > ; linux-usb@vger.kernel.org; open list > > Cc: Yinbo Zhu ; Xiaobo Xie ; Jiafei > Pan ; Ran Wang > Subject: [EXT] Re: [PATCH v1] usb: dwc3: remove the call t

RE: [PATCH v9 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

2019-08-11 Thread Pawel Laszczak
> >> >> Yes, driver frees not used buffers here. >> I think that it's the safest place for this purpose. >> >> > >> + dma_free_coherent(priv_dev->sysdev, buf- >> >size, >> + buf->buf, >> +

RE: [PATCH v9 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

2019-08-11 Thread Felipe Balbi
Hi, Pawel Laszczak writes: > Hi, > >> >>Pawel Laszczak writes: > +static int cdns3_gadget_start(struct cdns3 *cdns) > +{ > + struct cdns3_device *priv_dev; > + u32 max_speed; > + int ret; > + > + priv_dev = kzalloc(sizeof(*priv_dev), GFP_KERNEL); > + if (!priv_

RE: [EXT] Re: [PATCH v1] usb: dwc3: remove the call trace of USBx_GFLADJ

2019-08-11 Thread Felipe Balbi
Hi, Yinbo Zhu writes: >> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index >> > 98bce85c29d0..a133d8490322 100644 >> > --- a/drivers/usb/dwc3/core.c >> > +++ b/drivers/usb/dwc3/core.c >> > @@ -300,8 +300,7 @@ static void dwc3_frame_length_adjustment(struct >> > dwc3 *dwc) >