* [PATCH] gadgetfs: ep_io - wait until IRQ finishes
@ 2022-07-08 7:06 Jozef Martiniak
2022-07-08 7:19 ` Greg Kroah-Hartman
2022-07-08 14:39 ` Alan Stern
0 siblings, 2 replies; 4+ messages in thread
From: Jozef Martiniak @ 2022-07-08 7:06 UTC (permalink / raw)
To: jomajm
Cc: Felipe Balbi, Greg Kroah-Hartman, Alan Stern, Jens Axboe,
Hangyu Hua, Darrick J. Wong, Wei Ming Chen, Ingo Molnar,
Randy Dunlap, linux-usb, linux-kernel
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>
---
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 79990597c39f..01c3ead7d1b4 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.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gadgetfs: ep_io - wait until IRQ finishes
2022-07-08 7:06 [PATCH] gadgetfs: ep_io - wait until IRQ finishes Jozef Martiniak
@ 2022-07-08 7:19 ` Greg Kroah-Hartman
2022-07-08 7:29 ` Jozo M.
2022-07-08 14:39 ` Alan Stern
1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-08 7:19 UTC (permalink / raw)
To: Jozef Martiniak
Cc: Felipe Balbi, Alan Stern, Jens Axboe, Hangyu Hua, Darrick J. Wong,
Wei Ming Chen, Ingo Molnar, Randy Dunlap, linux-usb, linux-kernel
On Fri, Jul 08, 2022 at 09:06:44AM +0200, Jozef Martiniak wrote:
> 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>
What commit id does this fix?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gadgetfs: ep_io - wait until IRQ finishes
2022-07-08 7:19 ` Greg Kroah-Hartman
@ 2022-07-08 7:29 ` Jozo M.
0 siblings, 0 replies; 4+ messages in thread
From: Jozo M. @ 2022-07-08 7:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Felipe Balbi, Alan Stern, Jens Axboe, Hangyu Hua, Darrick J. Wong,
Wei Ming Chen, Ingo Molnar, Randy Dunlap, linux-usb, linux-kernel
The first commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
pi 8. 7. 2022 o 9:19 Greg Kroah-Hartman <gregkh@linuxfoundation.org> napísal(a):
>
> On Fri, Jul 08, 2022 at 09:06:44AM +0200, Jozef Martiniak wrote:
> > 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>
>
> What commit id does this fix?
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gadgetfs: ep_io - wait until IRQ finishes
2022-07-08 7:06 [PATCH] gadgetfs: ep_io - wait until IRQ finishes Jozef Martiniak
2022-07-08 7:19 ` Greg Kroah-Hartman
@ 2022-07-08 14:39 ` Alan Stern
1 sibling, 0 replies; 4+ messages in thread
From: Alan Stern @ 2022-07-08 14:39 UTC (permalink / raw)
To: Jozef Martiniak
Cc: Felipe Balbi, Greg Kroah-Hartman, Jens Axboe, Hangyu Hua,
Darrick J. Wong, Wei Ming Chen, Ingo Molnar, Randy Dunlap,
linux-usb, linux-kernel
On Fri, Jul 08, 2022 at 09:06:44AM +0200, Jozef Martiniak wrote:
> after usb_ep_queue() if wait_for_completion_interruptible() is
> interrupted we need to wait until IRQ gets finished.
This should say "request" or "I/O request", not "IRQ". Not a big deal.
>
> Otherwise complete() from epio_complete() can corrupt stack.
>
> Signed-off-by: Jozef Martiniak <jomajm@gmail.com>
> ---
Acked-by: Alan Stern <stern@rowland.harvard.edu>
> 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 79990597c39f..01c3ead7d1b4 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.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-08 14:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-08 7:06 [PATCH] gadgetfs: ep_io - wait until IRQ finishes Jozef Martiniak
2022-07-08 7:19 ` Greg Kroah-Hartman
2022-07-08 7:29 ` Jozo M.
2022-07-08 14:39 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox