Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3560204pxb; Mon, 24 Jan 2022 12:13:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9wBSZqnpbE1fflUJe4+Tg355BnqBJ8Mvx+whmGtZDr+twU3M5DzyxowdCajn1mkPoRk/A X-Received: by 2002:a05:6a00:1d26:b0:4c0:2388:73c6 with SMTP id a38-20020a056a001d2600b004c0238873c6mr15423594pfx.69.1643055219927; Mon, 24 Jan 2022 12:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055219; cv=none; d=google.com; s=arc-20160816; b=tAHETixFua0791LHdzzykTaxCMFP43xY6JvNDnBHkZAk0M4ndo4s4sbtVMSskVjeT1 B9fKFbrjA9OIZnTRcLG/zr+zi8Pn5pXxCxwAgAHRLUb89EwXQiME0G7eQud0vSanrJKK 3Oj3ef1ye1/ff+vn/cgDAA4L1excrm4h/OQ0oQKdMfTVp2qTOWbTUzE4SYGN6lrwO6iM 0IuK19SJNFVEjJJ/g9YBEs+fHghrTh+/hLhSzxs+8ODOEw9LgNFWfq4L6oDhk72dc8mE TBdRscPaqYGJ1VXpN6y+mS1BAF0nTlgWqtSfer/iuR5NknSXDKRZ5KBntFu8OeBJ1I0P Xxhw== 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=RRtcq9SwBUNO4tz1O2qSDpyKW/az2tTGC+4/6GYjkes=; b=MRpalcMTEK5+baVLTgV/gSNLI0/lFO6kok832UF5T4VGRs4Z3pEivuyogZ+Mm1tybX 2AIL9PH1UQNxucEn21sr8+cJK0wACYOJU9mSnCxTYx+jl0e0vUOUZKJpBozTgIFZRInh zmDhgFJ1TPKDO/dIteRltiKjYluaiO4H0eALZfuRITVOtPwzjGe3S0ikVkpfkW1tpvUA TsNpT1hvL2e7fkZTicJeqqcsBPRG7mfIo03aP6ZfPmwWWAwTPKbeucQQVPaorQwLECg/ ZwOwplNhNmS7mt1ex3D/mFNtkC4v/Zpj5elLTbyHiAo8UivyAOHfmjoyNEGSaMmz6Vlw 9XFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DprSpOEf; 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 m4si253857pjo.72.2022.01.24.12.13.27; Mon, 24 Jan 2022 12:13:39 -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=DprSpOEf; 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 S1347985AbiAXTOl (ORCPT + 99 others); Mon, 24 Jan 2022 14:14:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35822 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345431AbiAXTFv (ORCPT ); Mon, 24 Jan 2022 14:05:51 -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 898C060915; Mon, 24 Jan 2022 19:05:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59D29C340E8; Mon, 24 Jan 2022 19:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051150; bh=GI8rViXqs2bdhiSwCmv3aNUVUSabK0VoZcqOpoSJ5sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DprSpOEfUqe0sWrAnSRpWK5Lo4kOmPcwOsJbn2axPHKKnUUYh7sOpmgshEM8HFuy4 tcfubf/NqN+JYYX+q19Abg8FfugmiSuSx/VsIajztV6waro6mZvrPGYH5xuCGrZzgS E3qvipRKgUITwVjvok2o6evCNnuL3JJ7Ap/icR7s= 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.14 069/186] ALSA: jack: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:42:24 +0100 Message-Id: <20220124183939.346173866@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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 06764dc931848c3a9bc01a63bbf76a605408bb54 ] 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") Link: https://lore.kernel.org/r/20211116071314.15065-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/jack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/core/jack.c b/sound/core/jack.c index 5ddf81f091fa9..36cfe1c54109d 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -68,10 +68,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); -- 2.34.1