Skip to contentSkip to conversation

usb: gadget: function: fix missing spinlock in f_uac1_legacy

PATCH Superseded [email protected] 2 participants 3 messages Jul 6, 2020 USB

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: gadget: function: fix missing spinlock in f_uac1_legacy

From: Zhang Qiang <[email protected]>

Add a missing spinlock protection to the add operation of the "audio->play_queue" in "f_audio_out_ep_complete" function.

---
v1->v2:
Add changelog text.

 drivers/usb/gadget/function/f_uac1_legacy.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/f_uac1_legacy.c +2 -0
index 349deae7cabd..e2d7f69128a0 100644
@@ -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))
Signature · 1 line
2.24.1
maintainer
#1 lore raw
Quoted 4 lines · On Sun, Jul 05, 2020 at 02:16:16PM +0800, [email protected] wrote:

From: Zhang Qiang <[email protected]>

Add a missing spinlock protection to the add operation of the "audio->play_queue" in "f_audio_out_ep_complete" function.

That says _what_ you did, but not _why_ you did that. Why is a lock needed here? What does this protect?

What kernel commit does this "fix"? Put that in the "Fixes:" line, and probably you need a "cc: stable" in that area too, right?

thanks,

greg k-h

#2 lore raw

Thanks for your suggestin Greg KH
I think there is not need fix tags. I will resend.

thanks,
Zhang Qiang

________________________________________
发件人: Greg KH <[email protected]>
发送时间: 2020年7月6日 18:31
收件人: Zhang, Qiang
抄送: [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH v2] usb: gadget: function: fix missing spinlock in f_uac1_legacy

Quoted 4 lines · On Sun, Jul 05, 2020 at 02:16:16PM +0800, [email protected] wrote:

From: Zhang Qiang <[email protected]>

Add a missing spinlock protection to the add operation of the "audio->play_queue" in "f_audio_out_ep_complete" function.

That says _what_ you did, but not _why_ you did that. Why is a lock needed here? What does this protect?

What kernel commit does this "fix"? Put that in the "Fixes:" line, and probably you need a "cc: stable" in that area too, right?

thanks,

greg k-h