All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy
@ 2020-07-05 12:40 qiang.zhang
  2020-07-06 19:55 ` Greg KH
  2020-07-07  8:35 ` Sergei Shtylyov
  0 siblings, 2 replies; 5+ messages in thread
From: qiang.zhang @ 2020-07-05 12:40 UTC (permalink / raw)
  To: balbi; +Cc: colin.king, gregkh, linux-usb, linux-kernel, stable

From: Zhang Qiang <qiang.zhang@windriver.com>

Add a missing spinlock protection for play_queue, because
the play_queue may be destroyed when the "playback_work"
work func and "f_audio_out_ep_complete" callback func
operate this paly_queue at the same time.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
---
 v1->v2->v3:
 Add changelog text and Cc tags.

 drivers/usb/gadget/function/f_uac1_legacy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
index 349deae7cabd..e2d7f69128a0 100644
--- a/drivers/usb/gadget/function/f_uac1_legacy.c
+++ b/drivers/usb/gadget/function/f_uac1_legacy.c
@@ -336,7 +336,9 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req)
 
 	/* Copy buffer is full, add it to the play_queue */
 	if (audio_buf_size - copy_buf->actual < req->actual) {
+		spin_lock_irq(&audio->lock);
 		list_add_tail(&copy_buf->list, &audio->play_queue);
+		spin_unlock_irq(&audio->lock);
 		schedule_work(&audio->playback_work);
 		copy_buf = f_audio_buffer_alloc(audio_buf_size);
 		if (IS_ERR(copy_buf))
-- 
2.24.1


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

* Re: [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy
  2020-07-05 12:40 [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy qiang.zhang
@ 2020-07-06 19:55 ` Greg KH
  2020-07-07  2:28   ` 回复: " Zhang, Qiang
  2020-07-07  8:35 ` Sergei Shtylyov
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2020-07-06 19:55 UTC (permalink / raw)
  To: qiang.zhang; +Cc: balbi, colin.king, linux-usb, linux-kernel, stable

On Sun, Jul 05, 2020 at 08:40:27PM +0800, qiang.zhang@windriver.com wrote:
> From: Zhang Qiang <qiang.zhang@windriver.com>
> 
> Add a missing spinlock protection for play_queue, because
> the play_queue may be destroyed when the "playback_work"
> work func and "f_audio_out_ep_complete" callback func
> operate this paly_queue at the same time.

"play_queue", right?

> 
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>

Because you do not have a Fixes: tag in here, how far back do you want
the stable patch to go to?  That's why, if you can, it's always good to
have a "Fixes:" tag in there to show what commit caused the problem you
are fixing here.

So, what commit caused this?

thanks,

gre gk-h

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

* 回复: [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy
  2020-07-06 19:55 ` Greg KH
@ 2020-07-07  2:28   ` Zhang, Qiang
  2020-07-07  6:51     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Qiang @ 2020-07-07  2:28 UTC (permalink / raw)
  To: Greg KH; +Cc: balbi, colin.king, linux-usb, linux-kernel, stable

Hi Greg KH
In the early submission:
"commit id c6994e6f067cf0fc4c6cca3d164018b1150916f8" which add USB Audio Gadget driver "   
the "audio->play_queue" was protected from "audio->lock"
spinlock in "playback_work" func, But in "f_audio_out_ep_complete" func 
there is no protection for the operation of this "audio->play_queue". there
are missing spinlock,  Fix tags should add up here commit?

________________________________________
发件人: Greg KH <gregkh@linuxfoundation.org>
发送时间: 2020年7月7日 3:55
收件人: Zhang, Qiang
抄送: balbi@kernel.org; colin.king@canonical.com; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; stable@vger.kernel.org
主题: Re: [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy

On Sun, Jul 05, 2020 at 08:40:27PM +0800, qiang.zhang@windriver.com wrote:
> From: Zhang Qiang <qiang.zhang@windriver.com>
>
> Add a missing spinlock protection for play_queue, because
> the play_queue may be destroyed when the "playback_work"
> work func and "f_audio_out_ep_complete" callback func
> operate this paly_queue at the same time.

"play_queue", right?

>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>

Because you do not have a Fixes: tag in here, how far back do you want
the stable patch to go to?  That's why, if you can, it's always good to
have a "Fixes:" tag in there to show what commit caused the problem you
are fixing here.

So, what commit caused this?

thanks,

gre gk-h

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

* Re: 回复: [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy
  2020-07-07  2:28   ` 回复: " Zhang, Qiang
@ 2020-07-07  6:51     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2020-07-07  6:51 UTC (permalink / raw)
  To: Zhang, Qiang; +Cc: balbi, colin.king, linux-usb, linux-kernel, stable

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top


On Tue, Jul 07, 2020 at 02:28:36AM +0000, Zhang, Qiang wrote:
> Hi Greg KH
> In the early submission:
> "commit id c6994e6f067cf0fc4c6cca3d164018b1150916f8" which add USB Audio Gadget driver "   
> the "audio->play_queue" was protected from "audio->lock"
> spinlock in "playback_work" func, But in "f_audio_out_ep_complete" func 
> there is no protection for the operation of this "audio->play_queue". there
> are missing spinlock,  Fix tags should add up here commit?

I really do not understand what you are asking here, sorry.

greg k-h

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

* Re: [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy
  2020-07-05 12:40 [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy qiang.zhang
  2020-07-06 19:55 ` Greg KH
@ 2020-07-07  8:35 ` Sergei Shtylyov
  1 sibling, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2020-07-07  8:35 UTC (permalink / raw)
  To: qiang.zhang, balbi; +Cc: colin.king, gregkh, linux-usb, linux-kernel, stable

On 05.07.2020 15:40, qiang.zhang@windriver.com wrote:

> From: Zhang Qiang <qiang.zhang@windriver.com>
> 
> Add a missing spinlock protection for play_queue, because
> the play_queue may be destroyed when the "playback_work"
> work func and "f_audio_out_ep_complete" callback func
> operate this paly_queue at the same time.

    It's play_queue. :-)

> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
[...]

MBR, Sergei

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

end of thread, other threads:[~2020-07-07  8:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05 12:40 [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy qiang.zhang
2020-07-06 19:55 ` Greg KH
2020-07-07  2:28   ` 回复: " Zhang, Qiang
2020-07-07  6:51     ` Greg KH
2020-07-07  8:35 ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.