public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f_midi_complete to call tasklet_hi_schedule
@ 2025-02-06 19:23 Jillian Donahue
  2025-02-06 19:36 ` Jillian Donahue
  0 siblings, 1 reply; 7+ messages in thread
From: Jillian Donahue @ 2025-02-06 19:23 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel

From 9cb2628740d9f55f6f3faa5cce2de5eb8590f434 Mon Sep 17 00:00:00 2001
From: Jill Donahue <jilliandonahue58@gmail.com>
Date: Thu, 6 Feb 2025 10:18:05 -0700
Subject: [PATCH] f_midi_complete to call tasklet_hi_schedule

When using USB MIDI, a lock is attempted to be acquired twice through a
re-entrant call to f_midi_transmit, causing a deadlock.

Fix it by using tasklet_hi_schedule() to schedule the inner
f_midi_transmit() via a tasklet from the completion handler.

Link: https://lore.kernel.org/all/CAArt=LjxU0fUZOj06X+5tkeGT+6RbXzpWg1h4t4Fwa_KGVAX6g@mail.gmail>

Fixes: d5daf49b58661 ("USB: gadget: midi: add midi function driver")
Signed-off-by: Jill Donahue <jilliandonahue58@gmail.com>
---
 drivers/usb/gadget/function/f_midi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c
b/drivers/usb/gadget/function/f_midi.c
index 837fcdfa3..37d438e5d 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -283,7 +283,7 @@ f_midi_complete(struct usb_ep *ep, struct usb_request *req)
                        /* Our transmit completed. See if there's more to go.
                         * f_midi_transmit eats req, don't queue it again. */
                        req->length = 0;
-                       f_midi_transmit(midi);
+                       tasklet_hi_schedule(&midi->tasklet);
                        return;
                }
                break;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] f_midi_complete to call tasklet_hi_schedule
@ 2025-02-06 19:32 Jillian Donahue
  2025-02-07  9:35 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Jillian Donahue @ 2025-02-06 19:32 UTC (permalink / raw)
  To: gregkh, linux-kernel, linux-usb

From 9cb2628740d9f55f6f3faa5cce2de5eb8590f434 Mon Sep 17 00:00:00 2001
From: Jill Donahue <jilliandonahue58@gmail.com>
Date: Thu, 6 Feb 2025 10:18:05 -0700
Subject: [PATCH] f_midi_complete to call tasklet_hi_schedule

When using USB MIDI, a lock is attempted to be acquired twice through a
re-entrant call to f_midi_transmit, causing a deadlock.

Fix it by using tasklet_hi_schedule() to schedule the inner
f_midi_transmit() via a tasklet from the completion handler.

Link: https://lore.kernel.org/all/CAArt=LjxU0fUZOj06X+5tkeGT+6RbXzpWg1h4t4Fwa_KGVAX6g@mail.gmail.com/

Fixes: d5daf49b58661 ("USB: gadget: midi: add midi function driver")
Signed-off-by: Jill Donahue <jilliandonahue58@gmail.com>
---
 drivers/usb/gadget/function/f_midi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c
b/drivers/usb/gadget/function/f_midi.c
index 837fcdfa3..37d438e5d 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -283,7 +283,7 @@ f_midi_complete(struct usb_ep *ep, struct usb_request *req)
                        /* Our transmit completed. See if there's more to go.
                         * f_midi_transmit eats req, don't queue it again. */
                        req->length = 0;
-                       f_midi_transmit(midi);
+                       tasklet_hi_schedule(&midi->tasklet);
                        return;
                }
                break;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] f_midi_complete to call tasklet_hi_schedule
  2025-02-06 19:23 Jillian Donahue
@ 2025-02-06 19:36 ` Jillian Donahue
  0 siblings, 0 replies; 7+ messages in thread
From: Jillian Donahue @ 2025-02-06 19:36 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel

Sent with a broken link, my mistake

On Thu, Feb 6, 2025 at 12:23 PM Jillian Donahue
<jilliandonahue58@gmail.com> wrote:
>
> From 9cb2628740d9f55f6f3faa5cce2de5eb8590f434 Mon Sep 17 00:00:00 2001
> From: Jill Donahue <jilliandonahue58@gmail.com>
> Date: Thu, 6 Feb 2025 10:18:05 -0700
> Subject: [PATCH] f_midi_complete to call tasklet_hi_schedule
>
> When using USB MIDI, a lock is attempted to be acquired twice through a
> re-entrant call to f_midi_transmit, causing a deadlock.
>
> Fix it by using tasklet_hi_schedule() to schedule the inner
> f_midi_transmit() via a tasklet from the completion handler.
>
> Link: https://lore.kernel.org/all/CAArt=LjxU0fUZOj06X+5tkeGT+6RbXzpWg1h4t4Fwa_KGVAX6g@mail.gmail>
>
> Fixes: d5daf49b58661 ("USB: gadget: midi: add midi function driver")
> Signed-off-by: Jill Donahue <jilliandonahue58@gmail.com>
> ---
>  drivers/usb/gadget/function/f_midi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/f_midi.c
> b/drivers/usb/gadget/function/f_midi.c
> index 837fcdfa3..37d438e5d 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -283,7 +283,7 @@ f_midi_complete(struct usb_ep *ep, struct usb_request *req)
>                         /* Our transmit completed. See if there's more to go.
>                          * f_midi_transmit eats req, don't queue it again. */
>                         req->length = 0;
> -                       f_midi_transmit(midi);
> +                       tasklet_hi_schedule(&midi->tasklet);
>                         return;
>                 }
>                 break;
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] f_midi_complete to call tasklet_hi_schedule
  2025-02-06 19:32 [PATCH] f_midi_complete to call tasklet_hi_schedule Jillian Donahue
@ 2025-02-07  9:35 ` Greg KH
  2025-02-07 16:10   ` Jillian Donahue
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2025-02-07  9:35 UTC (permalink / raw)
  To: Jillian Donahue; +Cc: linux-kernel, linux-usb

On Thu, Feb 06, 2025 at 12:32:14PM -0700, Jillian Donahue wrote:
> >From 9cb2628740d9f55f6f3faa5cce2de5eb8590f434 Mon Sep 17 00:00:00 2001
> From: Jill Donahue <jilliandonahue58@gmail.com>
> Date: Thu, 6 Feb 2025 10:18:05 -0700
> Subject: [PATCH] f_midi_complete to call tasklet_hi_schedule

This all shouldn't be in the body of the email, please do not use web
email clients.  The kernel documentation should show you how to use git
send-email or other tools.

> 
> When using USB MIDI, a lock is attempted to be acquired twice through a
> re-entrant call to f_midi_transmit, causing a deadlock.
> 
> Fix it by using tasklet_hi_schedule() to schedule the inner
> f_midi_transmit() via a tasklet from the completion handler.
> 
> Link: https://lore.kernel.org/all/CAArt=LjxU0fUZOj06X+5tkeGT+6RbXzpWg1h4t4Fwa_KGVAX6g@mail.gmail.com/
> 
> Fixes: d5daf49b58661 ("USB: gadget: midi: add midi function driver")

No Cc: stable?

No blank line between Link: and Fixes: please

> Signed-off-by: Jill Donahue <jilliandonahue58@gmail.com>
> ---
>  drivers/usb/gadget/function/f_midi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

And this is a v2 patch, right?

> 
> diff --git a/drivers/usb/gadget/function/f_midi.c
> b/drivers/usb/gadget/function/f_midi.c
> index 837fcdfa3..37d438e5d 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -283,7 +283,7 @@ f_midi_complete(struct usb_ep *ep, struct usb_request *req)
>                         /* Our transmit completed. See if there's more to go.
>                          * f_midi_transmit eats req, don't queue it again. */
>                         req->length = 0;
> -                       f_midi_transmit(midi);
> +                       tasklet_hi_schedule(&midi->tasklet);
>                         return;
>                 }

Your whitespace is all damaged and this can't be applied :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] f_midi_complete to call tasklet_hi_schedule
  2025-02-07  9:35 ` Greg KH
@ 2025-02-07 16:10   ` Jillian Donahue
  2025-02-07 16:32     ` Greg KH
  2025-02-07 16:36     ` Sebastian Andrzej Siewior
  0 siblings, 2 replies; 7+ messages in thread
From: Jillian Donahue @ 2025-02-07 16:10 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, linux-usb

On Fri, Feb 7, 2025 at 2:35 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>   The kernel documentation should show you how to use git
> send-email or other tools.

ok, I will use this when I resubmit.

> No Cc: stable?

Cc: stable@vger.kernel.org
Like so? I just emailed the 3 from the maintainer script.

> And this is a v2 patch, right?

I have sent a few out because I cannot seem to get it right. I can add
v2 to the next one, if that helps.

> greg k-h
Jill

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] f_midi_complete to call tasklet_hi_schedule
  2025-02-07 16:10   ` Jillian Donahue
@ 2025-02-07 16:32     ` Greg KH
  2025-02-07 16:36     ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2025-02-07 16:32 UTC (permalink / raw)
  To: Jillian Donahue; +Cc: linux-kernel, linux-usb

On Fri, Feb 07, 2025 at 09:10:50AM -0700, Jillian Donahue wrote:
> On Fri, Feb 7, 2025 at 2:35 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >   The kernel documentation should show you how to use git
> > send-email or other tools.
> 
> ok, I will use this when I resubmit.
> 
> > No Cc: stable?
> 
> Cc: stable@vger.kernel.org
> Like so? I just emailed the 3 from the maintainer script.

Yes.  See:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for what that means.

> > And this is a v2 patch, right?
> 
> I have sent a few out because I cannot seem to get it right. I can add
> v2 to the next one, if that helps.

You have to, the Documentation says to :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] f_midi_complete to call tasklet_hi_schedule
  2025-02-07 16:10   ` Jillian Donahue
  2025-02-07 16:32     ` Greg KH
@ 2025-02-07 16:36     ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-02-07 16:36 UTC (permalink / raw)
  To: Jillian Donahue; +Cc: Greg KH, linux-kernel, linux-usb

On 2025-02-07 09:10:50 [-0700], Jillian Donahue wrote:
> > No Cc: stable?
> 
> Cc: stable@vger.kernel.org
> Like so? I just emailed the 3 from the maintainer script.

Yes, in the body before the sign-off and so on.

> > And this is a v2 patch, right?
> 
> I have sent a few out because I cannot seem to get it right. I can add
> v2 to the next one, if that helps.

This was v2. The next one will be v3.

> > greg k-h
> Jill

Sebastian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-02-07 16:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-06 19:32 [PATCH] f_midi_complete to call tasklet_hi_schedule Jillian Donahue
2025-02-07  9:35 ` Greg KH
2025-02-07 16:10   ` Jillian Donahue
2025-02-07 16:32     ` Greg KH
2025-02-07 16:36     ` Sebastian Andrzej Siewior
  -- strict thread matches above, loose matches on Subject: below --
2025-02-06 19:23 Jillian Donahue
2025-02-06 19:36 ` Jillian Donahue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox