#
b2a50ffd |
| 24-Jun-2024 |
Ma Ke <make24@iscas.ac.cn> |
usb: gadget: aspeed_udc: validate endpoint index for ast udc
[ Upstream commit ee0d382feb44ec0f445e2ad63786cd7f3f6a8199 ]
We should verify the bound of the array to assure that host may not manipul
usb: gadget: aspeed_udc: validate endpoint index for ast udc
[ Upstream commit ee0d382feb44ec0f445e2ad63786cd7f3f6a8199 ]
We should verify the bound of the array to assure that host may not manipulate the index to point past endpoint array.
Found by static analysis.
Signed-off-by: Ma Ke <make24@iscas.ac.cn> Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au> Link: https://lore.kernel.org/r/20240625022306.2568122-1-make24@iscas.ac.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
#
9ed8e8c4 |
| 12-Jun-2024 |
Jeremy Kerr <jk@codeconstruct.com.au> |
usb: gadget: aspeed_udc: fix device address configuration
commit dba7567c2fbbf10a4de2471cdb0e16e5572dc007 upstream.
In the aspeed UDC setup, we configure the UDC hardware with the assigned USB devi
usb: gadget: aspeed_udc: fix device address configuration
commit dba7567c2fbbf10a4de2471cdb0e16e5572dc007 upstream.
In the aspeed UDC setup, we configure the UDC hardware with the assigned USB device address.
However, we have an off-by-one in the bitmask, so we're only setting the lower 6 bits of the address (USB addresses being 7 bits, and the hardware bitmask being bits 0:6).
This means that device enumeration fails if the assigned address is greater than 64:
[ 344.607255] usb 1-1: new high-speed USB device number 63 using ehci-platform [ 344.808459] usb 1-1: New USB device found, idVendor=cc00, idProduct=cc00, bcdDevice= 6.10 [ 344.817684] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 344.825671] usb 1-1: Product: Test device [ 344.831075] usb 1-1: Manufacturer: Test vendor [ 344.836335] usb 1-1: SerialNumber: 00 [ 349.917181] usb 1-1: USB disconnect, device number 63 [ 352.036775] usb 1-1: new high-speed USB device number 64 using ehci-platform [ 352.249432] usb 1-1: device descriptor read/all, error -71 [ 352.696740] usb 1-1: new high-speed USB device number 65 using ehci-platform [ 352.909431] usb 1-1: device descriptor read/all, error -71
Use the correct mask of 0x7f (rather than 0x3f), and generate this through the GENMASK macro, so we have numbers that correspond exactly to the hardware register definition.
Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver") Cc: stable@vger.kernel.org Reviewed-by: Neal Liu <neal_liu@aspeedtech.com> Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Link: https://lore.kernel.org/r/20240613-aspeed-udc-v2-1-29501ce9cb7a@codeconstruct.com.au Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
50fd16eb |
| 26-Jul-2023 |
Yangtao Li <frank.li@vivo.com> |
usb: gadget: aspeed_udc: Convert to devm_platform_ioremap_resource()
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com> Link: https://lore.kernel.o
usb: gadget: aspeed_udc: Convert to devm_platform_ioremap_resource()
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li <frank.li@vivo.com> Link: https://lore.kernel.org/r/20230726113816.888-9-frank.li@vivo.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
70cdb930 |
| 28-Jun-2022 |
Dan Carpenter <dan.carpenter@oracle.com> |
usb: gadget: aspeed_udc: fix handling of tx_len == 0
The bug is that we should still enter this loop if "tx_len" is zero.
After adding the "last" variable, then the "chunk >= 0" condition is no lon
usb: gadget: aspeed_udc: fix handling of tx_len == 0
The bug is that we should still enter this loop if "tx_len" is zero.
After adding the "last" variable, then the "chunk >= 0" condition is no longer required but I left it for readability.
Fixes: c09b1f372e74 ("usb: gadget: aspeed_udc: cleanup loop in ast_dma_descriptor_setup()") Reported-by: Neal Liu <neal_liu@aspeedtech.com> Reviewed-by: Neal Liu <neal_liu@aspeedtech.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/Yrq6F5okoX1y05rT@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
44830e11 |
| 16-Jun-2022 |
Jiapeng Chong <jiapeng.chong@linux.alibaba.com> |
usb: gadget: Remove unnecessary print function dev_err()
The print function dev_err() is redundant because platform_get_irq() already prints an error.
This was found by coccicheck:
./drivers/usb/g
usb: gadget: Remove unnecessary print function dev_err()
The print function dev_err() is redundant because platform_get_irq() already prints an error.
This was found by coccicheck:
./drivers/usb/gadget/udc/aspeed_udc.c:1546:2-9: line 1546 is redundant because platform_get_irq() already prints an error.
Acked-by: Neal Liu <neal_liu@aspeedtech.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Link: https://lore.kernel.org/r/20220616090410.128483-1-jiapeng.chong@linux.alibaba.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
e2900f74 |
| 15-Jun-2022 |
Colin Ian King <colin.i.king@gmail.com> |
usb: gadget: ast2600: Fix a couple of spelling mistakes
There are a couple of spelling mistakes, one in a dev_warn message and another in a SETUP_DBG message. Fix these and remove an extraneous whit
usb: gadget: ast2600: Fix a couple of spelling mistakes
There are a couple of spelling mistakes, one in a dev_warn message and another in a SETUP_DBG message. Fix these and remove an extraneous white space too.
Acked-by: Neal Liu <neal_liu@aspeedtech.com> Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20220615073518.192827-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
c09b1f37 |
| 18-Jun-2022 |
Dan Carpenter <dan.carpenter@oracle.com> |
usb: gadget: aspeed_udc: cleanup loop in ast_dma_descriptor_setup()
The "chunk >= 0" condition does not work because count is a u32. Also, really we shouldn't enter the loop when "chunk" is zero.
O
usb: gadget: aspeed_udc: cleanup loop in ast_dma_descriptor_setup()
The "chunk >= 0" condition does not work because count is a u32. Also, really we shouldn't enter the loop when "chunk" is zero.
Once that condition is fixed then there is no need for the "last" variable. I reversed the "if (chunk <= ep->chunk_max)" as well. The new loop is much simpler.
Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/Yq2SvM2bbrtSd1H9@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
3d393f03 |
| 16-Jun-2022 |
Zheng Bin <zhengbin13@huawei.com> |
usb: gadget: aspeed_udc: fix missing spin_unlock_irqrestore in ast_udc_ep_queue
ast_udc_ep_queue misses spin_unlock_irqrestore in an error path, this patch fixes that.
Fixes: 055276c13205 ("usb: ga
usb: gadget: aspeed_udc: fix missing spin_unlock_irqrestore in ast_udc_ep_queue
ast_udc_ep_queue misses spin_unlock_irqrestore in an error path, this patch fixes that.
Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver") Reviewed-by: Neal Liu <neal_liu@aspeedtech.com> Signed-off-by: Zheng Bin <zhengbin13@huawei.com> Link: https://lore.kernel.org/r/20220616133508.3655864-1-zhengbin13@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
055276c1 |
| 22-May-2022 |
Neal Liu <neal_liu@aspeedtech.com> |
usb: gadget: add Aspeed ast2600 udc driver
Aspeed udc is compliant with USB2.0, supports USB High Speed and Full Speed, backward compatible with USB1.1.
Supports independent DMA channel for each ge
usb: gadget: add Aspeed ast2600 udc driver
Aspeed udc is compliant with USB2.0, supports USB High Speed and Full Speed, backward compatible with USB1.1.
Supports independent DMA channel for each generic endpoint. Supports 32/256 stages descriptor mode for all generic endpoints.
This driver supports full functionality including single/multiple stages descriptor mode, and exposes 1 UDC gadget driver.
Signed-off-by: Neal Liu <neal_liu@aspeedtech.com> Link: https://lore.kernel.org/r/20220523030134.2977116-2-neal_liu@aspeedtech.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|