* [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode
@ 2022-08-14 15:29 Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 05/56] usb: cdns3 fix use-after-free at workaround 2 Sasha Levin
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Gil Fine, Mika Westerberg, Sasha Levin, andreas.noever,
michael.jamet, YehezkelShB, linux-usb
From: Gil Fine <gil.fine@intel.com>
[ Upstream commit 5fd6b9a5cbe63fea4c490fee8af34144a139a266 ]
In case of uni-directional time sync, TMU handshake is
initiated by upstream router. In case of bi-directional
time sync, TMU handshake is initiated by downstream router.
In order to handle correctly the case of uni-directional mode,
we avoid changing the upstream router's rate to off,
because it might have another downstream router plugged that is set to
uni-directional mode (and we don't want to change its mode).
Instead, we always change downstream router's rate.
Signed-off-by: Gil Fine <gil.fine@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/thunderbolt/tmu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c
index e4a07a26f693..93ba1d00335b 100644
--- a/drivers/thunderbolt/tmu.c
+++ b/drivers/thunderbolt/tmu.c
@@ -359,13 +359,14 @@ int tb_switch_tmu_disable(struct tb_switch *sw)
* In case of uni-directional time sync, TMU handshake is
* initiated by upstream router. In case of bi-directional
* time sync, TMU handshake is initiated by downstream router.
- * Therefore, we change the rate to off in the respective
- * router.
+ * We change downstream router's rate to off for both uni/bidir
+ * cases although it is needed only for the bi-directional mode.
+ * We avoid changing upstream router's mode since it might
+ * have another downstream router plugged, that is set to
+ * uni-directional mode and we don't want to change it's TMU
+ * mode.
*/
- if (unidirectional)
- tb_switch_tmu_rate_write(parent, TB_SWITCH_TMU_RATE_OFF);
- else
- tb_switch_tmu_rate_write(sw, TB_SWITCH_TMU_RATE_OFF);
+ tb_switch_tmu_rate_write(sw, TB_SWITCH_TMU_RATE_OFF);
tb_port_tmu_time_sync_disable(up);
ret = tb_port_tmu_time_sync_disable(down);
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 05/56] usb: cdns3 fix use-after-free at workaround 2
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 06/56] usb: cdns3: fix random warning message when driver load Sasha Levin
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Frank Li, Faqiang Zhu, Greg Kroah-Hartman, Sasha Levin,
peter.chen, pawell, linux-usb
From: Frank Li <Frank.Li@nxp.com>
[ Upstream commit 7d602f30149a117eea260208b1661bc404c21dfd ]
BUG: KFENCE: use-after-free read in __list_del_entry_valid+0x10/0xac
cdns3_wa2_remove_old_request()
{
...
kfree(priv_req->request.buf);
cdns3_gadget_ep_free_request(&priv_ep->endpoint, &priv_req->request);
list_del_init(&priv_req->list);
^^^ use after free
...
}
cdns3_gadget_ep_free_request() free the space pointed by priv_req,
but priv_req is used in the following list_del_init().
This patch move list_del_init() before cdns3_gadget_ep_free_request().
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Faqiang Zhu <faqiang.zhu@nxp.com>
Link: https://lore.kernel.org/r/20220608190430.2814358-1-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/cdns3/cdns3-gadget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index d6d515d598dc..c4f90b124e55 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -625,9 +625,9 @@ static void cdns3_wa2_remove_old_request(struct cdns3_endpoint *priv_ep)
trace_cdns3_wa2(priv_ep, "removes eldest request");
kfree(priv_req->request.buf);
+ list_del_init(&priv_req->list);
cdns3_gadget_ep_free_request(&priv_ep->endpoint,
&priv_req->request);
- list_del_init(&priv_req->list);
--priv_ep->wa2_counter;
if (!chain)
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 06/56] usb: cdns3: fix random warning message when driver load
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 05/56] usb: cdns3 fix use-after-free at workaround 2 Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 07/56] usb: gadget: uvc: calculate the number of request depending on framesize Sasha Levin
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Frank Li, Greg Kroah-Hartman, Sasha Levin, peter.chen, pawell,
linux-usb
From: Frank Li <Frank.Li@nxp.com>
[ Upstream commit 8659ab3d936fcf0084676f98b75b317017aa8f82 ]
Warning log:
[ 4.141392] Unexpected gfp: 0x4 (GFP_DMA32). Fixing up to gfp: 0xa20 (GFP_ATOMIC). Fix your code!
[ 4.150340] CPU: 1 PID: 175 Comm: 1-0050 Not tainted 5.15.5-00039-g2fd9ae1b568c #20
[ 4.158010] Hardware name: Freescale i.MX8QXP MEK (DT)
[ 4.163155] Call trace:
[ 4.165600] dump_backtrace+0x0/0x1b0
[ 4.169286] show_stack+0x18/0x68
[ 4.172611] dump_stack_lvl+0x68/0x84
[ 4.176286] dump_stack+0x18/0x34
[ 4.179613] kmalloc_fix_flags+0x60/0x88
[ 4.183550] new_slab+0x334/0x370
[ 4.186878] ___slab_alloc.part.108+0x4d4/0x748
[ 4.191419] __slab_alloc.isra.109+0x30/0x78
[ 4.195702] kmem_cache_alloc+0x40c/0x420
[ 4.199725] dma_pool_alloc+0xac/0x1f8
[ 4.203486] cdns3_allocate_trb_pool+0xb4/0xd0
pool_alloc_page(struct dma_pool *pool, gfp_t mem_flags)
{
...
page = kmalloc(sizeof(*page), mem_flags);
page->vaddr = dma_alloc_coherent(pool->dev, pool->allocation,
&page->dma, mem_flags);
...
}
kmalloc was called with mem_flags, which is passed down in
cdns3_allocate_trb_pool() and have GFP_DMA32 flags.
kmall_fix_flags() report warning.
GFP_DMA32 is not useful at all. dma_alloc_coherent() will handle
DMA memory region correctly by pool->dev. GFP_DMA32 can be removed
safely.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20220609154456.2871672-1-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/cdns3/cdns3-gadget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index c4f90b124e55..c7c394402e44 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -220,7 +220,7 @@ int cdns3_allocate_trb_pool(struct cdns3_endpoint *priv_ep)
if (!priv_ep->trb_pool) {
priv_ep->trb_pool = dma_pool_alloc(priv_dev->eps_dma_pool,
- GFP_DMA32 | GFP_ATOMIC,
+ GFP_ATOMIC,
&priv_ep->trb_pool_dma);
if (!priv_ep->trb_pool)
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 07/56] usb: gadget: uvc: calculate the number of request depending on framesize
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 05/56] usb: cdns3 fix use-after-free at workaround 2 Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 06/56] usb: cdns3: fix random warning message when driver load Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 08/56] usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info Sasha Levin
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Michael Grzeschik, Dan Vacura, Greg Kroah-Hartman, Sasha Levin,
laurent.pinchart, balbi, linux-usb
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
[ Upstream commit 87d76b5f1d8eeb49efa16e2018e188864cbb9401 ]
The current limitation of possible number of requests being handled is
dependent on the gadget speed. It makes more sense to depend on the
typical frame size when calculating the number of requests. This patch
is changing this and is using the previous limits as boundaries for
reasonable minimum and maximum number of requests.
For a 1080p jpeg encoded video stream with a maximum imagesize of
e.g. 800kB with a maxburst of 8 and an multiplier of 1 the resulting
number of requests is calculated to 49.
800768 1
nreqs = ------ * -------------- ~= 49
2 (1024 * 8 * 1)
Tested-by: Dan Vacura <w36195@motorola.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220529223848.105914-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/uvc_queue.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c
index 2cda982f3765..5b78e000cded 100644
--- a/drivers/usb/gadget/function/uvc_queue.c
+++ b/drivers/usb/gadget/function/uvc_queue.c
@@ -44,7 +44,8 @@ static int uvc_queue_setup(struct vb2_queue *vq,
{
struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
struct uvc_video *video = container_of(queue, struct uvc_video, queue);
- struct usb_composite_dev *cdev = video->uvc->func.config->cdev;
+ unsigned int req_size;
+ unsigned int nreq;
if (*nbuffers > UVC_MAX_VIDEO_BUFFERS)
*nbuffers = UVC_MAX_VIDEO_BUFFERS;
@@ -53,10 +54,16 @@ static int uvc_queue_setup(struct vb2_queue *vq,
sizes[0] = video->imagesize;
- if (cdev->gadget->speed < USB_SPEED_SUPER)
- video->uvc_num_requests = 4;
- else
- video->uvc_num_requests = 64;
+ req_size = video->ep->maxpacket
+ * max_t(unsigned int, video->ep->maxburst, 1)
+ * (video->ep->mult);
+
+ /* We divide by two, to increase the chance to run
+ * into fewer requests for smaller framesizes.
+ */
+ nreq = DIV_ROUND_UP(DIV_ROUND_UP(sizes[0], 2), req_size);
+ nreq = clamp(nreq, 4U, 64U);
+ video->uvc_num_requests = nreq;
return 0;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 08/56] usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
` (2 preceding siblings ...)
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 07/56] usb: gadget: uvc: calculate the number of request depending on framesize Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 16/56] usb: host: ohci-ppc-of: Fix refcount leak bug Sasha Levin
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Michael Grzeschik, Laurent Pinchart, Greg Kroah-Hartman,
Sasha Levin, balbi, linux-usb
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
[ Upstream commit a725d0f6dfc5d3739d6499f30ec865305ba3544d ]
Likewise to the uvcvideo hostside driver, this patch is changing the
usb_request message of an non zero completion handler call from dev_info
to dev_warn.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220529223848.105914-4-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/uvc_video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index 4e4a7c312646..6fabdea0ddd6 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -258,7 +258,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)
break;
default:
- uvcg_info(&video->uvc->func,
+ uvcg_warn(&video->uvc->func,
"VS request completed with status %d.\n",
req->status);
uvcg_queue_cancel(queue, 0);
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 16/56] usb: host: ohci-ppc-of: Fix refcount leak bug
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
` (3 preceding siblings ...)
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 08/56] usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 17/56] usb: renesas: " Sasha Levin
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Liang He, Alan Stern, Greg Kroah-Hartman, Sasha Levin, linux-usb
From: Liang He <windhl@126.com>
[ Upstream commit 40a959d7042bb7711e404ad2318b30e9f92c6b9b ]
In ohci_hcd_ppc_of_probe(), of_find_compatible_node() will return
a node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220617034637.4003115-1-windhl@126.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/host/ohci-ppc-of.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 45f7cceb6df3..98e46725999e 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -169,6 +169,7 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op)
release_mem_region(res.start, 0x4);
} else
pr_debug("%s: cannot get ehci offset from fdt\n", __FILE__);
+ of_node_put(np);
}
irq_dispose_mapping(irq);
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 17/56] usb: renesas: Fix refcount leak bug
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
` (4 preceding siblings ...)
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 16/56] usb: host: ohci-ppc-of: Fix refcount leak bug Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 19/56] usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 27/56] gadgetfs: ep_io - wait until IRQ finishes Sasha Levin
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Liang He, Greg Kroah-Hartman, Sasha Levin, linux-usb
From: Liang He <windhl@126.com>
[ Upstream commit 9d6d5303c39b8bc182475b22f45504106a07f086 ]
In usbhs_rza1_hardware_init(), of_find_node_by_name() will return
a node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220618023205.4056548-1-windhl@126.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/renesas_usbhs/rza.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/renesas_usbhs/rza.c b/drivers/usb/renesas_usbhs/rza.c
index 24de64edb674..2d77edefb4b3 100644
--- a/drivers/usb/renesas_usbhs/rza.c
+++ b/drivers/usb/renesas_usbhs/rza.c
@@ -23,6 +23,10 @@ static int usbhs_rza1_hardware_init(struct platform_device *pdev)
extal_clk = of_find_node_by_name(NULL, "extal");
of_property_read_u32(usb_x1_clk, "clock-frequency", &freq_usb);
of_property_read_u32(extal_clk, "clock-frequency", &freq_extal);
+
+ of_node_put(usb_x1_clk);
+ of_node_put(extal_clk);
+
if (freq_usb == 0) {
if (freq_extal == 12000000) {
/* Select 12MHz XTAL */
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 19/56] usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
` (5 preceding siblings ...)
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 17/56] usb: renesas: " Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 27/56] gadgetfs: ep_io - wait until IRQ finishes Sasha Levin
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Amelie Delaunay, Minas Harutyunyan, Fabrice Gasnier,
Greg Kroah-Hartman, Sasha Levin, linux-usb
From: Amelie Delaunay <amelie.delaunay@foss.st.com>
[ Upstream commit db638c6500abaffb8f7770b2a69c40d003d54ae1 ]
When using usb-role-switch, D+ pull-up is set as soon as DTCL_SFTDISCON is
cleared, whatever the vbus valid signal state is. The pull-up should not
be set when vbus isn't present (this is determined by the drd controller).
This patch ensures that B-Session (so Peripheral role + vbus valid signal)
is valid before clearing the DCTL_SFTDISCON bit when role switch is used.
Keep original behavior when usb-role-switch isn't used.
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20220622160717.314580-1-fabrice.gasnier@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc2/gadget.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index fe2a58c75861..8b15742d9e8a 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3594,7 +3594,8 @@ void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg)
{
/* remove the soft-disconnect and let's go */
- dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
+ if (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD))
+ dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
}
/**
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 5.18 27/56] gadgetfs: ep_io - wait until IRQ finishes
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
` (6 preceding siblings ...)
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 19/56] usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch Sasha Levin
@ 2022-08-14 15:29 ` Sasha Levin
7 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2022-08-14 15:29 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Jozef Martiniak, Greg Kroah-Hartman, Sasha Levin, balbi, stern,
axboe, hbh25y, rdunlap, mingo, linux-usb
From: Jozef Martiniak <jomajm@gmail.com>
[ Upstream commit 04cb742d4d8f30dc2e83b46ac317eec09191c68e ]
after usb_ep_queue() if wait_for_completion_interruptible() is
interrupted we need to wait until IRQ gets finished.
Otherwise complete() from epio_complete() can corrupt stack.
Signed-off-by: Jozef Martiniak <jomajm@gmail.com>
Link: https://lore.kernel.org/r/20220708070645.6130-1-jomajm@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/legacy/inode.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index 0c01e749f9ea..b9d3eed6bec8 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -362,6 +362,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len)
spin_unlock_irq (&epdata->dev->lock);
DBG (epdata->dev, "endpoint gone\n");
+ wait_for_completion(&done);
epdata->status = -ENODEV;
}
}
--
2.35.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-08-14 15:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-14 15:29 [PATCH AUTOSEL 5.18 01/56] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 05/56] usb: cdns3 fix use-after-free at workaround 2 Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 06/56] usb: cdns3: fix random warning message when driver load Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 07/56] usb: gadget: uvc: calculate the number of request depending on framesize Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 08/56] usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 16/56] usb: host: ohci-ppc-of: Fix refcount leak bug Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 17/56] usb: renesas: " Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 19/56] usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch Sasha Levin
2022-08-14 15:29 ` [PATCH AUTOSEL 5.18 27/56] gadgetfs: ep_io - wait until IRQ finishes Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).