]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: imx-audmix: Add NULL check in imx_audmix_probe
authorCharles Han <hanchunchao@inspur.com>
Mon, 18 Nov 2024 08:45:53 +0000 (16:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:05 +0000 (13:54 +0100)
[ Upstream commit e038f43edaf0083f6aa7c9415d86cf28dfd152f9 ]

devm_kasprintf() can return a NULL pointer on failure,but this
returned value in imx_audmix_probe() is not checked.
Add NULL check in imx_audmix_probe(), to handle kernel NULL
pointer dereference error.

Fixes: 05d996e11348 ("ASoC: imx-audmix: Split capture device for audmix")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://patch.msgid.link/20241118084553.4195-1-hanchunchao@inspur.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/fsl/imx-audmix.c

index 6fbcf33fd0dea6373b0a104d1654013882e274ca..8e7b75cf64db425da24b1fa092094e011fa1b6c9 100644 (file)
@@ -275,6 +275,9 @@ static int imx_audmix_probe(struct platform_device *pdev)
                /* Add AUDMIX Backend */
                be_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
                                         "audmix-%d", i);
+               if (!be_name)
+                       return -ENOMEM;
+
                priv->dai[num_dai + i].cpus     = &dlc[1];
                priv->dai[num_dai + i].codecs   = &snd_soc_dummy_dlc;