Skip to content

Commit c67b973

Browse files
committed
ASoC: imx-card: Add NULL check in imx_card_probe()
JIRA: https://issues.redhat.com/browse/RHEL-80657 CVE: CVE-2025-22066 commit 93d3460 Author: Henry Martin <bsdhenrymartin@gmail.com> Date: Tue Apr 1 22:25:10 2025 +0800 ASoC: imx-card: Add NULL check in imx_card_probe() devm_kasprintf() returns NULL when memory allocation fails. Currently, imx_card_probe() does not check for this case, which results in a NULL pointer dereference. Add NULL check after devm_kasprintf() to prevent this issue. Fixes: aa73670 ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20250401142510.29900-1-bsdhenrymartin@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
1 parent e5e1201 commit c67b973

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sound/soc/fsl/imx-card.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,8 @@ static int imx_card_probe(struct platform_device *pdev)
772772
data->dapm_routes[i].sink =
773773
devm_kasprintf(&pdev->dev, GFP_KERNEL, "%d %s",
774774
i + 1, "Playback");
775+
if (!data->dapm_routes[i].sink)
776+
return -ENOMEM;
775777
data->dapm_routes[i].source = "CPU-Playback";
776778
}
777779
}
@@ -789,6 +791,8 @@ static int imx_card_probe(struct platform_device *pdev)
789791
data->dapm_routes[i].source =
790792
devm_kasprintf(&pdev->dev, GFP_KERNEL, "%d %s",
791793
i + 1, "Capture");
794+
if (!data->dapm_routes[i].source)
795+
return -ENOMEM;
792796
data->dapm_routes[i].sink = "CPU-Capture";
793797
}
794798
}

0 commit comments

Comments
 (0)