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 159BC15B998; Tue, 16 Jun 2026 15:53:15 +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=1781625196; cv=none; b=BLiiUPhkYoU/ZSqX2nEJml61uy6VpKvmzhtfQxbs8XF++Ml0KBNhLkJtiIU7UhnTboJwtu+KdWRj0RbyYguZnOi4n9xvS2kxaMFGNKpc55jNmAzk48ieK+REH4JBPbW/w07vUl6Ys9Z8UAUYKFJrvNEbjsJDsFWTFFPdWL9bsjU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781625196; c=relaxed/simple; bh=gP2JFt+3eg+MNaDxWLZoVOeFCHVfKEUGlpeOcofgAKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BHuhTk9769NzvfYBgHmk4045qBadEV7SbSKJDCVDYbs8zfqNKcXWhy6TKCFPPJDh1ZZRfdwsOCqX/mEiQuwYDqrBh5JgT6T7ewt20MVkO0EtDZfbmqj2iwV8GRuqXNZG3ohNngPhGzTtM1ai3hvHFiJApKxJvAcF6GgW8WfuMzk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=N7PUrE94; 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="N7PUrE94" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EDE11F000E9; Tue, 16 Jun 2026 15:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781625195; bh=ZCJmjEQzCyn5jgLG1zcfmaivmQvtuz7f3S9u1L4OYcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N7PUrE94wCJ1/Djw+l8SfUyO/R+/L7ELzZ+Km98WCHQUiuLIpOO8iF2xzyf+z1RS6 NzzTMxiqmQ2Am41Ri4JbeJzaJCTyBz9cbB0gAlnuY9HKtDiQUUYITQkY4LoKyGLehY mW/mMa6/qsqthV8EiXP0RF8ai7OBvsi8XKMHPboI= 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.18 096/325] ASoC: wm_adsp: Fix NULL dereference when removing firmware controls Date: Tue, 16 Jun 2026 20:28:12 +0530 Message-ID: <20260616145102.472698612@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145057.827196531@linuxfoundation.org> References: <20260616145057.827196531@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.18-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 8782c331e92529..751a3c25e4f0b1 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -666,6 +666,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