From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C942243E4BC; Tue, 16 Jun 2026 17:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629319; cv=none; b=TQTim5h1uZ6PkTiIPbbmZGL3zFokuCVSc6nqgWNRx8BXy/FdF68x2YicQfO5Rw3NzATi/27L19euwYoyv2K8Dci1w6ZVHEIWBKSRuywOubbi7FZ5Pec9WYx9Vba5TitPm6JhipbOoSGY4YSdxjffaZgB9Qn0uVbvM51Rx0R/C6k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629319; c=relaxed/simple; bh=bUHHb9bW674boIpkqipcxQRtrpZVkB1bYgbWlQhMC+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UJSzU3cVcJzhhF9Zafm4q5gnr0L8YiVBc8NSrr7EvNaeFn47D4aCOfa/Isbr8zUWvtAd+77ktpgoU7wr6fB0i5CtV1QR3LHwN0L4qDQfq1NZpEFzL9KPb3ejHpTJBHgkcgEDCJ4dcoiL4JFBuFIMkHdbQoEzyzEV2EzAvDxbR+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hEIOdyIw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hEIOdyIw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0D451F000E9; Tue, 16 Jun 2026 17:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781629318; bh=Z4DaDeR5VsTwQgg+zPjwFPrL+J4puuZKCm/jE1NamWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hEIOdyIwCt4Dtymwtzy6WKdEDnzzvKwaq7/mXFc+74lgA9onpEQAYTJihyeEJQLeM mA9QNwA6EVVux5y7NyRbfMuKGZv41l9kGHFq+dM5eGFntjVTGypUwEvPmEoCRIepoP cDRMcrC65pW3oLHoAJXzo9WOFeI1ZQgQWZhGtpcg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Richard Fitzgerald , Mark Brown , Sasha Levin Subject: [PATCH 6.6 263/452] ASoC: wm_adsp: Fix NULL dereference when removing firmware controls Date: Tue, 16 Jun 2026 20:28:10 +0530 Message-ID: <20260616145131.428010247@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145117.796205997@linuxfoundation.org> References: <20260616145117.796205997@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Fitzgerald [ Upstream commit 7d3fb78b550301e43fdc60312aed733069694426 ] In wm_adsp_control_remove() check that the priv pointer is not NULL before attempting to cleanup what it points to. When cs_dsp creates a control it calls wm_adsp_control_add_cb() so that wm_adsp can create its own private control data. There are two cases where private data is not created: 1. The control is a SYSTEM control, so an ALSA control is not created. 2. The codec driver has registered a control_add() callback that hides the control, so wm_adsp_control_add() is not called. When cs_dsp_remove destroys its control list it calls wm_adsp_control_remove() for each control. But wm_adsp_control_remove() was attempting to cleanup the private data pointed to by cs_ctl->priv without checking the pointer for NULL. Signed-off-by: Richard Fitzgerald Fixes: 0700bc2fb94c ("ASoC: wm_adsp: Separate generic cs_dsp_coeff_ctl handling") Link: https://patch.msgid.link/20260604101244.1402862-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm_adsp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index b9c20e29fe63ef..2da19de4800e2f 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -674,6 +674,9 @@ static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) { struct wm_coeff_ctl *ctl = cs_ctl->priv; + if (!ctl) + return; + cancel_work_sync(&ctl->work); kfree(ctl->name); -- 2.53.0