From patchwork Tue Nov 16 07:13:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12621609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD3AAC433F5 for ; Tue, 16 Nov 2021 07:14:22 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A343260184 for ; Tue, 16 Nov 2021 07:14:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A343260184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 74F461683; Tue, 16 Nov 2021 08:13:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 74F461683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637046859; bh=DLyty+uVOqgHt3H4tVXA8GTbXuNl8YL/ZbScUIsriWQ=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=LXSHIPssWR0hxgEFFMUhVl3e5W1+j47rZygvF//w+eW7S4GLYD3lfMV6MoJN/SR/3 Z4GH1V5lAbUgWLVmmDmiLFvpVgo2qRl1NI/SUV7deiNRKkl5dCbYRGIE062FmUZGRY LIojc+QDX9OqoCYT4Q9ryDrs8UUFAtuswP4Vbsns= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 02599F80272; Tue, 16 Nov 2021 08:13:29 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E91FFF802C4; Tue, 16 Nov 2021 08:13:26 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 84FAEF800FA for ; Tue, 16 Nov 2021 08:13:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 84FAEF800FA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="h2qtOn55"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="C6ik6hjU" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B8483218BB for ; Tue, 16 Nov 2021 07:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1637046797; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EakwiiJVZ4Mbo2CV8wfllOCGcwBMKyBDpXRnCumoCXk=; b=h2qtOn55b6+jSTCZrJ4355mGo/0qyCRHwAVdSdFfL2QVX2uAHC+I68JXUIQKCX+PpHRHB5 XS+TCzSH/k7Du3xe/VNM0IvsfpACwY0zY/N2L4MlLMywYjZ2lzpif3hv+w3HNcpUhL+0hM 0/TZO4Gww7lSORqLU9DTCliQBB6ltJg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1637046797; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EakwiiJVZ4Mbo2CV8wfllOCGcwBMKyBDpXRnCumoCXk=; b=C6ik6hjU8e45/k8iYktfvFM6GZ7hmxP5BzYDMqMSjA0IyLThcM/WzIWV8Ll7Sigi1q1Dk1 ys1EIX8sGEjKHSCQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id A7DDDA3B81; Tue, 16 Nov 2021 07:13:17 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 1/3] ALSA: jack: Add missing rwsem around snd_ctl_remove() calls Date: Tue, 16 Nov 2021 08:13:12 +0100 Message-Id: <20211116071314.15065-1-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: 9058cbe1eed2 ("ALSA: jack: implement kctl creating for jack devices") Signed-off-by: Takashi Iwai --- sound/core/jack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/core/jack.c b/sound/core/jack.c index 32350c6aba84..f50a1e920e1d 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -62,10 +62,13 @@ static int snd_jack_dev_free(struct snd_device *device) struct snd_card *card = device->card; struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; + down_write(&card->controls_rwsem); list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { list_del_init(&jack_kctl->list); snd_ctl_remove(card, jack_kctl->kctl); } + up_write(&card->controls_rwsem); + if (jack->private_free) jack->private_free(jack); From patchwork Tue Nov 16 07:13:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12621611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99583C433EF for ; Tue, 16 Nov 2021 07:15:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87C1B60184 for ; Tue, 16 Nov 2021 07:15:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 87C1B60184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E45EB1697; Tue, 16 Nov 2021 08:14:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E45EB1697 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637046904; bh=sC2Oarsm1QwXbJj4I/WRNHrfG8GoqbSDb6AqJNSMkUA=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kY8Xhu4jwOfPtlK6xyeUMjmvYZfdNN8L28kuvLN+B3v0UpsT4Osi/AA6/QV0DAV0r baahJAYYOOoGviWVz8xJuss+1oGKZWNtwm3r7uY44aQ2RrWiz78ULGYTODWYP9Srtd 8kInnJ61TofBnCi7fxy5oBuMMdta+muV3w6G4hoo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CBCA4F804C1; Tue, 16 Nov 2021 08:13:29 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BA218F802C4; Tue, 16 Nov 2021 08:13:27 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 62745F80089 for ; Tue, 16 Nov 2021 08:13:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 62745F80089 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ZjmjYvAQ"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="CZfnCoah" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A7720218CE for ; Tue, 16 Nov 2021 07:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1637046798; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z7p4WeaN8eE2dq5mxU9fmogRj+7uZWhYN5IEeSyBYAo=; b=ZjmjYvAQLJ4MDlWxmkR9Ha0QZB69LKN8bjX7dBsmQpqsex50SKR8HTlVom5qrPUpF+Ue9M WyNx8g39EApJx0+B8rPuNbCc4M9IeXSuIA4MGb2pu0oEd1BKaxnTnPDKcl07ipu6WykbXK KE77qenW2YjJErhiBS1lzx5MdtXiadY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1637046798; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z7p4WeaN8eE2dq5mxU9fmogRj+7uZWhYN5IEeSyBYAo=; b=CZfnCoah/u0PLU/79oLzflMMZkpweb5C5ZGVuy7W+e48a7XsXVG5Fgv+gV76aQxdEgHfcu o9QzGOcsfBeAJuAg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 96905A3B84; Tue, 16 Nov 2021 07:13:18 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 2/3] ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls Date: Tue, 16 Nov 2021 08:13:13 +0100 Message-Id: <20211116071314.15065-2-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211116071314.15065-1-tiwai@suse.de> References: <20211116071314.15065-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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") Signed-off-by: Takashi Iwai --- 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 6fd3677685d7..ba4a987ed1c6 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; } } From patchwork Tue Nov 16 07:13:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12621613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EACFC433F5 for ; Tue, 16 Nov 2021 07:15:14 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0DEB60184 for ; Tue, 16 Nov 2021 07:15:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A0DEB60184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B16A216A2; Tue, 16 Nov 2021 08:14:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B16A216A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637046911; bh=EyJuToFR4H7TS2+MR8rJeytooPKOWf4cLxcp9SuuZ5c=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nPwkUYRZnfreU6inomT0KeOD7W0G5R5H6mMumd0X6eKFO/aE8Q7VU0AAbmYCehQFN smZxa6EENMBxO/4FEitbHon033JyuDteqze7Yiul52HB5LTDJJe3i5EqqCV8QNanSY GuBBxH/Yiba15KgZsQoeQk9Z0nVSS70cxoDGSIXo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 86A02F804C3; Tue, 16 Nov 2021 08:13:34 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 59063F804E7; Tue, 16 Nov 2021 08:13:32 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0CA6DF8026D for ; Tue, 16 Nov 2021 08:13:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0CA6DF8026D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="dK674Yfo"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="gdj74LJc" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 75DF81FC9E for ; Tue, 16 Nov 2021 07:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1637046799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gx7svMbROXQy3z0yDxLw7KUsN13UGdFAw9oE/A6YTEo=; b=dK674Yfo3F0wtqnSSnseM30rc3vk/ktHBjCYmPb5rXHcjX0AOyzkCqLor38SGSDoU/4egq vGwJpZreLhrViGzSZuejXgBmMyHyWEgEv3hB/dSVVm5EXTxzfmdFjsXLviVVu1nhsRpBSO KV6ABkvI233kfLkiSkYzuGkLC8o1Uyo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1637046799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gx7svMbROXQy3z0yDxLw7KUsN13UGdFAw9oE/A6YTEo=; b=gdj74LJc1LXds9OSrevh2HMpxi3ZVfGA6UQxdgiDMXeJcoS7ANfWQwvMe4CcLjimMpwL37 dgoUnUjo32F2MxDw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 65C49A3B84; Tue, 16 Nov 2021 07:13:19 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 3/3] ALSA: hda: Add missing rwsem around snd_ctl_remove() calls Date: Tue, 16 Nov 2021 08:13:14 +0100 Message-Id: <20211116071314.15065-3-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211116071314.15065-1-tiwai@suse.de> References: <20211116071314.15065-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: d13bd412dce2 ("ALSA: hda - Manage kcontrol lists") Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0c4a337c9fc0..eda70814369b 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1727,8 +1727,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) { int i; struct hda_nid_item *items = codec->mixers.list; + + down_write(&codec->card->controls_rwsem); for (i = 0; i < codec->mixers.used; i++) snd_ctl_remove(codec->card, items[i].kctl); + up_write(&codec->card->controls_rwsem); snd_array_free(&codec->mixers); snd_array_free(&codec->nids); }