Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3593227pxb; Mon, 24 Jan 2022 13:03:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCfKmbPpkCRCdFIXX64ji6G1uzztqoxxL7tE/Wjx3CCOR0eDQ9U8HHOE85FTrbLEcOj1M1 X-Received: by 2002:a62:cd4b:0:b0:4c7:f198:6eb1 with SMTP id o72-20020a62cd4b000000b004c7f1986eb1mr10601054pfg.1.1643058230324; Mon, 24 Jan 2022 13:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058230; cv=none; d=google.com; s=arc-20160816; b=N6LSmBeJ4+CULj9yBOF1t/9ZdN6I+3oo3Hx2hFoo7GhCbogxK7od1KJvLaPNZW/0kf 9kEA92Y95ndsz2QKbVT6Pk25T1ZwTEDXX4NfkYIBe+yhz6OMdFX6rb9eqtoliXRlqEez xrtyi7LdV+AtL1OZtXOTbru9VtDR1TVuKxIqv5YbCGiFW3+uhKLC+/Uval3C7fijLmdY tOGebvyiF+8EHpy16R2EqT+iflJ6faasF30TTJVC6M/3+P0Rdja/2RuFU9bmZuQeXgmD TZK7uf80t3hqOvNb0JvsuzVcmXfX1sa2bDpRuPMYY4kmZSLRyfuyW27kYnrd7OhqU4/x hwUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gcH4VOJ5LtI0BfvocqTERYpZeJmSQW1l2qems1HrsMw=; b=g1ZcX1TG7+OrsTfTw40aRDmkcMgymT3WPDsgDpIItH1+nOhMNzJSZIG+rkMwlMFz7W ObqAWO489iiJqUD/Pv0IfAs7wT0OLUbtuMFhfxS6E3ZEJ8kmLkQ4y8NzihtiDnAoHJnE QDHiJRvB9i+vt11mICQ5y7rN1oWKqoxu3Tq5tMSrjA1XIQHs3vJOKf8XPGH0wk9pneVc mn+Mxlrh4O5B9M0xHbRUXMXSnPM/ZzzVcMpHkegv17xjoZtY3dS+m/F/yleUYhFi8lHc ftoJ+miLOeMQtDW1gJPE/YW0Sa6K9BQS3vRMDwUaI1UBTJr1m1KqOTcbit96H1vzaanI Myrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QEJESrdD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si1560240pgb.140.2022.01.24.13.03.27; Mon, 24 Jan 2022 13:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QEJESrdD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383720AbiAXU1j (ORCPT + 99 others); Mon, 24 Jan 2022 15:27:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377239AbiAXUFL (ORCPT ); Mon, 24 Jan 2022 15:05:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F865C061A11; Mon, 24 Jan 2022 11:30:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD69AB8121A; Mon, 24 Jan 2022 19:30:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CBCDC340E5; Mon, 24 Jan 2022 19:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052637; bh=bI71+dy3SjHsHKJSLG3Irk1aXpUx+GZcgDpdDh66Suk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QEJESrdDd5ZgIwu+XX32/dUPnTwYI76YaubPZqEZEeROW5gaQ89YsON9ImTjsYdjY U0YW6pxQEOF+L0eBRDmctQoR2qx0lqhFtOcYEhQnXSPFQn82o1xGuAUeFXGtDzslbN nNkg9TuftotPFdcoH3ApCXPDjgwHW17ooPRcQofQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 124/320] ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:41:48 +0100 Message-Id: <20220124183957.897720160@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai [ Upstream commit 5471e9762e1af4b7df057a96bfd46cc250979b88 ] snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: a8ff48cb7083 ("ALSA: pcm: Free chmap at PCM free callback, too") Link: https://lore.kernel.org/r/20211116071314.15065-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 9a72d641743d9..f8ce961c28d6e 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); static void free_chmap(struct snd_pcm_str *pstr) { if (pstr->chmap_kctl) { - snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); + struct snd_card *card = pstr->pcm->card; + + down_write(&card->controls_rwsem); + snd_ctl_remove(card, pstr->chmap_kctl); + up_write(&card->controls_rwsem); pstr->chmap_kctl = NULL; } } -- 2.34.1