From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41146C433DF for ; Fri, 10 Jul 2020 10:41:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1CDCE207DF for ; Fri, 10 Jul 2020 10:41:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594377677; bh=mYmhqC2+fRZ5NSFr0QrBX4ayvtcDm9hSNrpu+vut8r4=; h=Subject:To:From:Date:List-ID:From; b=PB8JniBmPTW9BifVZCSpuJbr8Eig0deFcfHkat3cNl3CLe8is/eKsA5JNgijjHg2x aJ71xCBHTezML9OtTf8xfC5C5K+abkS8EoNbU/GlnWPJhnM3bCl2FULiB6yRO9Lxqf +OCrmH9Z5PcObs6V9n8Po+4flE4VflI+Z8Z3XCPI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726965AbgGJKlO (ORCPT ); Fri, 10 Jul 2020 06:41:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:45052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726369AbgGJKkp (ORCPT ); Fri, 10 Jul 2020 06:40:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23D8920767; Fri, 10 Jul 2020 10:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594377644; bh=mYmhqC2+fRZ5NSFr0QrBX4ayvtcDm9hSNrpu+vut8r4=; h=Subject:To:From:Date:From; b=zq3GrSNiMH/MC+rnTXaCGj/ia4vXwuLuwTd0drY2Se0hNALPfvSgeAnLNSgHk2Phj H0W2aZl1y6R5f1wMd9CwyeHV7cmO3fOQSeH+d0Qsx9fKN3fC52fr0XV3QjHZtBmXIC oFVlHaYpHqtYWXnHrIlpdXcosRI9gyHjOa/chXV4= Subject: patch "usb: gadget: function: fix missing spinlock in f_uac1_legacy" added to usb-linus To: qiang.zhang@windriver.com, balbi@kernel.org, stable@vger.kernel.org From: Date: Fri, 10 Jul 2020 12:40:30 +0200 Message-ID: <15943776303364@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled usb: gadget: function: fix missing spinlock in f_uac1_legacy to my usb git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git in the usb-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From 8778eb0927ddcd3f431805c37b78fa56481aeed9 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Mon, 6 Jul 2020 13:14:55 +0800 Subject: usb: gadget: function: fix missing spinlock in f_uac1_legacy 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. Fixes: c6994e6f067cf ("USB: gadget: add USB Audio Gadget driver") Cc: stable Signed-off-by: Zhang Qiang Signed-off-by: Felipe Balbi --- 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(©_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.27.0