Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547239pxb; Mon, 24 Jan 2022 11:56:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS491lz0QvybTRqQA+3tknDXLi2QIndz7MmwM/DcRT+p2e/GqWydP9/XjJuxjlujWHKC2H X-Received: by 2002:a17:902:8605:b0:149:9a25:103c with SMTP id f5-20020a170902860500b001499a25103cmr15628850plo.155.1643054214315; Mon, 24 Jan 2022 11:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054214; cv=none; d=google.com; s=arc-20160816; b=M/uEvOvuqE+t4BfL8lxSScj4dibGm63xEzgn2DC2ULdvUDgNTMpJnBOFc6qXSrS5Io BUaN6jy4KIAHsaQq+LJBDK/kcLZx2RsWjWDZZCxvO3t8J4FnGa8JBHFBe6jZGGjXkugH 8MYH71GuWXmUmLUwPLV8uJb6yqwtTRLdXFsC+SthcRjTIWSD/prF0m6LG2941+Wm7fKP d051HffmsPTJAJ5E9oaFdQ9jhSSwt8QzVTlmaB8emHdb8Bu5saN56t2wwHENxtqFSGoY +vrrvMZEfq6ibKw5goBmor0sFNC4oNwnuox5S9I/IkM992La8G35ApvoxwereXTQP3Mi 9KUA== 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=u0t1Wg5hm30/y0xmzxmlFHTPxD+Aw02wmDwWIVEXt64=; b=inRDKswS7Kfb5BL7p6zKJFpphUWSwYXClNRftBDStuUCVfH5+3kGx0j/Iwna1IjEON wJ3ikbns7GCRO0fpdh55AycIFWWszYHhlE8wxMspJMlTpBYBD5CNNHx9oXrAJRtIWpRl Sa134PJNZ9e62d0HKKZRaib7zwVeY+KLvtwlbSZ+RwPEGts+xUVzHSZGbfEOdWXI0ZTF g4LczDSBRPKwy9cyAp1C7nofNDVZRa0Xb3K71UzUAlWMpDpLDThcqZa7HB0EXoqlFqgh Sktox5prdP4AnwlVQBNwGwrN0WHl+fZnyLEzXmJcgRhYH3/p1KvOMW+jBsQZyotNxa39 sE7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v7KYNRYA; 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 q1si721845pfu.353.2022.01.24.11.56.42; Mon, 24 Jan 2022 11:56:54 -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=v7KYNRYA; 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 S1343670AbiAXSvT (ORCPT + 99 others); Mon, 24 Jan 2022 13:51:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48884 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245556AbiAXSuM (ORCPT ); Mon, 24 Jan 2022 13:50:12 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 30DC9614CF; Mon, 24 Jan 2022 18:50:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BF7BC340E5; Mon, 24 Jan 2022 18:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050211; bh=pEIEsDSrG3oWDQUzVwhFvwuMJ95sRq01nVXR4rmLB9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7KYNRYAUMYZdRTogzo3P2mb3SKW/7tn1VZcr8COPmsgpEQcSoURG/+nvMI3aoBW6 SaU+daEhlfJrz2yAXK+wXeGvF4NehQY/GXyZzZAWr/r+w9bByZqyOjN4gFsLvHRRxg aCfmzQ8c9WASMi3BohRKhbFyPYmvafbCQroxil7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 4.4 044/114] ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:42:19 +0100 Message-Id: <20220124183928.467243188@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@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 cdff5f9764808..6ae28dcd79945 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -857,7 +857,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