From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2AA245945; Wed, 3 Jul 2024 11:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004977; cv=none; b=b8PMidKHn1QQxJGSKrjuPtNDlBUUnTBDOqbG6itjIbRTeW12RLSqHoge6Q2ZpyjCscKmZNQZLkNqwVHstuB2Ty5khnS/lKiHmOd4C2NaUaewcFN5UXRVCgGrwwhxi8AxgfRDMMTD3tZMcJ/1b7qK7L73lRpBcuzw3K+2Qu0M8LI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004977; c=relaxed/simple; bh=mYk6Vgg3v7OZ3AJMDWjcnfTUzTi+F++yYiCwA9t+uwU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QyTN/kVZKuom4a6tboDbXjgGavL1cNhbPF1v9TcZAaGU9bwh/kW+QUxBz2AjFuTv9F8XzbSePcj2X9co2867Am97fUq5ogYsdn1OAPwh4awEeNTeqT6Ta5AZYZqNKTfMuQJ1bb/XHNep29i3ZcZyM4CulfwnJaS9U1nYa61Uzkc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DtbrExcw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DtbrExcw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE29EC2BD10; Wed, 3 Jul 2024 11:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720004977; bh=mYk6Vgg3v7OZ3AJMDWjcnfTUzTi+F++yYiCwA9t+uwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DtbrExcwgASG8yuLNuaTFr1+9MzBmM2RLIj5T9CZHpSoJXdDifU8rIthDdh1/bWVD rebtfZ7aAxOTVE2lR2NnSI8XwAIpgpbyDuzeBZXEbdxti1z10ul1O43LK98AE3SqkB vHFiii+/ZUoResncgYIbZt5O8ieTcfGWLYHj8zrU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Elinor Montmasson , Mark Brown , Sasha Levin Subject: [PATCH 5.10 218/290] ASoC: fsl-asoc-card: set priv->pdev before using it Date: Wed, 3 Jul 2024 12:39:59 +0200 Message-ID: <20240703102912.391880379@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703102904.170852981@linuxfoundation.org> References: <20240703102904.170852981@linuxfoundation.org> User-Agent: quilt/0.67 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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Elinor Montmasson [ Upstream commit 90f3feb24172185f1832636264943e8b5e289245 ] priv->pdev pointer was set after being used in fsl_asoc_card_audmux_init(). Move this assignment at the start of the probe function, so sub-functions can correctly use pdev through priv. fsl_asoc_card_audmux_init() dereferences priv->pdev to get access to the dev struct, used with dev_err macros. As priv is zero-initialised, there would be a NULL pointer dereference. Note that if priv->dev is dereferenced before assignment but never used, for example if there is no error to be printed, the driver won't crash probably due to compiler optimisations. Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support") Signed-off-by: Elinor Montmasson Link: https://patch.msgid.link/20240620132511.4291-2-elinor.montmasson@savoirfairelinux.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/fsl-asoc-card.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 9a756d0a60320..c876f111d8b03 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -538,6 +538,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + priv->pdev = pdev; + cpu_np = of_parse_phandle(np, "audio-cpu", 0); /* Give a chance to old DT binding */ if (!cpu_np) @@ -718,7 +720,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) } /* Initialize sound card */ - priv->pdev = pdev; priv->card.dev = &pdev->dev; priv->card.owner = THIS_MODULE; ret = snd_soc_of_parse_card_name(&priv->card, "model"); -- 2.43.0