Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3590138pxb; Mon, 24 Jan 2022 12:59:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9YwsZv9XFUElNWfa1ngjDs8Jw5Rt067Ix1p7r0m4ap9+a96wYBs2RrU34lZO3Rpqg1wBX X-Received: by 2002:a63:5009:: with SMTP id e9mr9965265pgb.9.1643057981057; Mon, 24 Jan 2022 12:59:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643057981; cv=none; d=google.com; s=arc-20160816; b=APXS1KP0OFmkqgr7+la3eTUi8N+2yTQxuIFfxxjuSCOJpzUBMZ7K+pxsyyqLQsONy8 d5EOByMPyrmYhgod48nVbS/6UPVTDCojXxx24FaK+zinmh3O5I+WpuTb4ZIqUVNKETFu 33Jf1wCS/UZJmRtLz475Enkd7Axolh/HkJiTSS05mbXVhQQAuowuS+TPSXXPk1gNdBpD kRjl6dMmSDLXY1idFteT3NMUCLgkNywUIRqmzAdhZi097OMOMLA/KUOLXvimo0gLP7ll Dz5SPJzCk9PllEk7ZnGZrkTyoOybp6fWK4IcuDqft7sUZLamN+EV7h6Hp6nlaa2G4lMf Wudw== 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=R/1tCwtUpO2JWGLrzgIEb3fH5bKlI66Gd+gf4QivtGc=; b=t9vwgqxHDLFoa6mw/Nj3d542qku4smKergqWhiCph7RTHBFAJoLWNdAHCX3y+z2npr LO/626w+SYav3J0LvwIkk9pDldy7my8UXRa0G4AlHRYkN39f48IkxM8PzsW6yV0P2nET 3xOg5ZSPBTDwEdhd4ftSDLlEttW96WFPh+lrAK4Vp4H9x+CuxKLBPfdjrurMURsgSiMS uwSPkLCqWnEhhltMg80mtru2qtRS2WI83y4SCaWueanuZQxS+HlXIBlyjPgco3qfYwOu CUcenekFRD6hexifibKs6USSeyAnwYytllx8+Hl12sh0gByvS/5iHwtDzihHAbWi7Q27 jUzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="BwMcz/yo"; 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 p12si14437205plq.183.2022.01.24.12.59.26; Mon, 24 Jan 2022 12:59:41 -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="BwMcz/yo"; 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 S1381928AbiAXUY4 (ORCPT + 99 others); Mon, 24 Jan 2022 15:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377240AbiAXUFL (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 1C3B2C08E803; Mon, 24 Jan 2022 11:30:43 -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 D835BB8121B; Mon, 24 Jan 2022 19:30:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14A99C340E5; Mon, 24 Jan 2022 19:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052640; bh=1hDgkUT07j19aBXT2Go+t8wv9L8LkMKR1sBjhqc3N+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwMcz/yoYwUWyH328nkwD+ufLwE/mpI/7hhweH8Yyai+8r5//Guhzixq5sk6FdEwN 7Hl5v8a2XBj9EzF68Y0Sj0cp5FMcFIXE5rM6FscU9ifA8gw0rZAUdMt9Enr+4gRaZ9 wL3TppVgR/vA7VEfe6/FQgjbUBvpw1vUmNjUt1kw= 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 125/320] ALSA: hda: Add missing rwsem around snd_ctl_remove() calls Date: Mon, 24 Jan 2022 19:41:49 +0100 Message-Id: <20220124183957.929170787@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 80bd64af75b4bb11c0329bc66c35da2ddfb66d88 ] 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") Link: https://lore.kernel.org/r/20211116071314.15065-3-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- 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 326f95ce5ceb1..c8847de8388f0 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1721,8 +1721,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); } -- 2.34.1