usb: gadget: function: fix missing spinlock in f_uac1_legacy
Subsystems (2)
PATCH v3 1/1 usb: gadget: function: fix missing spinlock in f_uac1_legacy
From: Zhang Qiang <[email protected]>
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.
---
v1->v2->v3:
Add changelog text and Cc tags.
drivers/usb/gadget/function/f_uac1_legacy.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/f_uac1_legacy.c +2 -0
@@ -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 (©_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))
Signature · 1 line
2.24.1
Greg KH
maintainerQuoted 6 lines · On Sun, Jul 05, 2020 at 08:40:27PM +0800, [email protected] wrote:
From: Zhang Qiang <[email protected]>
Add a missing spinlock protection for
play_queue, because theplay_queuemay be destroyed when the "playback_work" work func and "f_audio_out_ep_complete" callback func operate thispaly_queueat the same time.
"play_queue", right?
Quoted 3 lines
Cc stable <[email protected]>Signed-off-by Zhang Qiang <[email protected]>
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
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 <[email protected]>
发送时间: 2020年7月7日 3:55
收件人: Zhang, Qiang
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH v3] usb: gadget: function: fix missing spinlock in f_uac1_legacy
Quoted 6 lines · On Sun, Jul 05, 2020 at 08:40:27PM +0800, [email protected] wrote:
From: Zhang Qiang <[email protected]>
Add a missing spinlock protection for
play_queue, because theplay_queuemay be destroyed when the "playback_work" work func and "f_audio_out_ep_complete" callback func operate thispaly_queueat the same time.
"play_queue", right?
Quoted 3 lines
Cc stable <[email protected]>Signed-off-by Zhang Qiang <[email protected]>
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
Greg KH
maintainerA: 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
Quoted 7 lines · Qiang
Hi Greg KH
In the early submission:
"commit idc6994e6f067cf0fc4c6cca3d164018b1150916f8" 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
Quoted 6 lines · On 05.07.2020 15:40, [email protected] wrote:
From: Zhang Qiang <[email protected]>
Add a missing spinlock protection for
play_queue, because theplay_queuemay be destroyed when the "playback_work" work func and "f_audio_out_ep_complete" callback func operate thispaly_queueat the same time.
It's play_queue. :-)
Quoted 2 lines
Cc stable <[email protected]>Signed-off-by Zhang Qiang <[email protected]>
[...]
MBR, Sergei