From: Thorsten Blum Date: Tue, 10 Jun 2025 10:32:16 +0000 (+0200) Subject: ASoC: sdw_utils: Fix potential NULL pointer deref in is_sdca_endpoint_present() X-Git-Tag: v6.16-rc3~19^2~1^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6325766d69900d1aa9733fc7572456fc4427b708;p=thirdparty%2Fkernel%2Flinux.git ASoC: sdw_utils: Fix potential NULL pointer deref in is_sdca_endpoint_present() Check the return value of kzalloc() and exit early to avoid a potential NULL pointer dereference. Cc: stable@vger.kernel.org Fixes: 4f8ef33dd44a ("ASoC: soc_sdw_utils: skip the endpoint that doesn't present") Signed-off-by: Thorsten Blum Link: https://patch.msgid.link/20250610103225.1475-2-thorsten.blum@linux.dev Signed-off-by: Mark Brown --- diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c index b7060b7463562..d75e7292240ba 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -1205,6 +1205,8 @@ static int is_sdca_endpoint_present(struct device *dev, int i; dlc = kzalloc(sizeof(*dlc), GFP_KERNEL); + if (!dlc) + return -ENOMEM; adr_end = &adr_dev->endpoints[end_index]; dai_info = &codec_info->dais[adr_end->num];