From patchwork Wed Feb 21 15:04:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 774546 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 48DAEC48BC3 for ; Wed, 21 Feb 2024 15:08:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6E36C847; Wed, 21 Feb 2024 16:08:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6E36C847 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708528095; bh=w+dJPyOkY5qsuIzQgZfSwqb9xanTcEuadfMSXxqoeBM=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=QLGil+mCnOnxus6Fe1YI87NCpie5lP8wAuRNb32LJl8yn7ZXu4SWWXFZzJBn3nagT nKKHBphNfofHk30LbDQl/TwOWNDeS2BTkB7Ln0rRPYam1dBHZTwMFmp+fvnssI+2+D gm96mNH9b0yglrtCMp7l2I16XzsE8yL/s/Y0EWRY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0F8F8F806CE; Wed, 21 Feb 2024 16:05:56 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 24B21F806DC; Wed, 21 Feb 2024 16:05:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 948F8F8065E; Wed, 21 Feb 2024 16:05:45 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 37FB0F80570 for ; Wed, 21 Feb 2024 16:05:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 37FB0F80570 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=cirrus.com header.i=@cirrus.com header.a=rsa-sha256 header.s=PODMain02222019 header.b=Xa6Z0iZR Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41L72AOx020807; Wed, 21 Feb 2024 09:05:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=4PkYbCkiKIkB58Faq2G3nqngCiyJ4P2kQI5muB7wT6Q=; b= Xa6Z0iZR+77w3EQxC+7S5zndnTobyRZiyo+e5k8x1hUZN0LhlCITeHhOpWaAfDBs oQnO/HkXNVbLgLFqM9C+lKsYMYVZS5NY/4DVMjATfNKXRgInRvUOt5krwrczAFpu UwKImNX8guoDPICSlHB1ZiHrlf2m2/c/OKCaCpXPZnInJWmka/a6G+4PJaFnQOi2 fk7WBleRuL4tqlYKF9/PjoCpdDYRZ3rw6Sqv2LnvECuLHnkQADXYcggabQZvYpar HkFSQ724eFQp0uPUPXFX3keKIUhGGFEokjugFBinxt3DkuI9tzLszVan98Skex60 3uSsIg/lYSXIHq5aD+TyZA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3wd207h58t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Feb 2024 09:05:09 -0600 (CST) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 21 Feb 2024 15:05:07 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.40 via Frontend Transport; Wed, 21 Feb 2024 15:05:07 +0000 Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.18]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 1721E820248; Wed, 21 Feb 2024 15:05:07 +0000 (UTC) From: Richard Fitzgerald To: , CC: , , , , "Richard Fitzgerald" Subject: [PATCH 1/9] ASoC: wm_adsp: Fix missing mutex_lock in wm_adsp_write_ctl() Date: Wed, 21 Feb 2024 15:04:59 +0000 Message-ID: <20240221150507.1039979-2-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240221150507.1039979-1-rf@opensource.cirrus.com> References: <20240221150507.1039979-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: uDnOhEGR_jtgGxSdppD9YoZ1qcO6fB7t X-Proofpoint-ORIG-GUID: uDnOhEGR_jtgGxSdppD9YoZ1qcO6fB7t X-Proofpoint-Spam-Reason: safe Message-ID-Hash: VGOMIP5EMYQRCFVDLEFMQNM2HB76TBMD X-Message-ID-Hash: VGOMIP5EMYQRCFVDLEFMQNM2HB76TBMD X-MailFrom: prvs=97814b2c7f=rf@opensource.cirrus.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: wm_adsp_write_ctl() must hold the pwr_lock mutex when calling cs_dsp_get_ctl(). This was previously partially fixed by commit 781118bc2fc1 ("ASoC: wm_adsp: Fix missing locking in wm_adsp_[read|write]_ctl()") but this only put locking around the call to cs_dsp_coeff_write_ctrl(), missing the call to cs_dsp_get_ctl(). Signed-off-by: Richard Fitzgerald Fixes: 781118bc2fc1 ("ASoC: wm_adsp: Fix missing locking in wm_adsp_[read|write]_ctl()") --- sound/soc/codecs/wm_adsp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 36ea0dcdc7ab..9cb9068c0462 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -683,11 +683,12 @@ static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type, unsigned int alg, void *buf, size_t len) { - struct cs_dsp_coeff_ctl *cs_ctl = cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg); + struct cs_dsp_coeff_ctl *cs_ctl; struct wm_coeff_ctl *ctl; int ret; mutex_lock(&dsp->cs_dsp.pwr_lock); + cs_ctl = cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg); ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len); mutex_unlock(&dsp->cs_dsp.pwr_lock);