Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3579184pxb; Mon, 24 Jan 2022 12:41:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJygXJwYayCAq6ORVw1ASete306mM9DlEdhq91C4YLEvS6ehoKd/wtacsGT96eg0VQsddRbn X-Received: by 2002:a17:902:b116:b0:14a:a4a1:e7a4 with SMTP id q22-20020a170902b11600b0014aa4a1e7a4mr15367746plr.82.1643056898204; Mon, 24 Jan 2022 12:41:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056898; cv=none; d=google.com; s=arc-20160816; b=tKijoLfQA7DacAR7/KLybjK35fBYKIYlNoBDWUrVDqASTkd3x6BCISVUp7C4St7wwl wBoGp6QaFrIjfGl0Fq9zvwpgx6628QJLya4ImZA1RQuDjCnq0dONKgOpWiETNv080QMR 8i13qWOu4Rq8BWKDcx3e1F5an8xAsuhonxWWMxPQQ7wLKanYzlfVxwYGUfwtCVTWeWBW BX/aPaXgos+30h+Ksreg+nwWvdS60TCFb245ypHSWsOPKquUW4pkNt3XuG6xIDOgNvme Lq2V1Ch2Z9vlbAJwwYvXddPyLE3H8z4MDfFuAl8bkh/BlN7HecU++fWfrtXD3LkBCiMw O74Q== 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=6NMOYjG1Vd4sQN7z+LHt1gaYWCh6QOO+JzwayHHt244=; b=kXPLTBpSxPT5NPPv5kC4ZoMgA0rfpdLSI8RcEHy8tfgmMfPUhvpw7uxY3fGUUlhKs1 lXs9F1BAICIj65wYvvoZBEnRgKHrGWp6l9ojdtdnG7qbA3kVJwGcH5T9Wso3kjXCUa7O iig2vp86wqErfTmeNSskm3Anz40rLWNun4jPxdy5iLoQAgSvw9aoGRVHsm21ETV3TjG/ uQH1c77uDdUeoC0Wn3LmQLRj3ZWLfIEFeWdQTJg9RVHp4+J4wjCt076nXVb58bul5rUN /08rmmIGUzxKUVe7tgpkkZD2HhA8n+IM5wLoEbY9YgYJe/OZkLH2F4G0IPAKJPLncTqm SmxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1aRgW+Kz; 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 q3si11991313pln.403.2022.01.24.12.41.22; Mon, 24 Jan 2022 12:41:38 -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=1aRgW+Kz; 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 S1359225AbiAXT4h (ORCPT + 99 others); Mon, 24 Jan 2022 14:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345733AbiAXThN (ORCPT ); Mon, 24 Jan 2022 14:37:13 -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 11563C0604F5; Mon, 24 Jan 2022 11:17:15 -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 C1CE1B81240; Mon, 24 Jan 2022 19:17:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF6BAC340E8; Mon, 24 Jan 2022 19:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051832; bh=YMq4YagArqu2SkbnR06hP9VJO2Gh6ajfWQWPQ1uzrCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1aRgW+Kz1JjebxkWt5C0UfGEH887IUDZsr3X+RpqTPa8JnYaqgpb/NhEbwAPO3O6n xmLbT7j5/MLkbtcVbz2bUHcccvJ1G9w2LjbfEmdMqS7852yM1+BeQ8MAHosXEyi8T9 Pm6G/rIVNPAPUzA42KPTmIhUIZ/Nl/UqbqVKjNoU= 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.19 100/239] ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:42:18 +0100 Message-Id: <20220124183946.284895097@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 01b9d62eef14d..b6ed38dec4357 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -874,7 +874,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