From: Kefeng Wang Date: Mon, 24 May 2021 02:49:41 +0000 (+0800) Subject: ASoC: core: Fix Null-point-dereference in fmt_single_name() X-Git-Tag: accepted/tizen/unified/20230118.172025~7091^2~1^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=41daf6ba594d55f201c50280ebcd430590441da1;p=platform%2Fkernel%2Flinux-rpi.git ASoC: core: Fix Null-point-dereference in fmt_single_name() Check the return value of devm_kstrdup() in case of Null-point-dereference. Fixes: 45dd9943fce0 ("ASoC: core: remove artificial component and DAI name constraint") Cc: Dmitry Baryshkov Reported-by: Hulk Robot Signed-off-by: Kefeng Wang Link: https://lore.kernel.org/r/20210524024941.159952-1-wangkefeng.wang@huawei.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1c0904a..a76974c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2225,6 +2225,8 @@ static char *fmt_single_name(struct device *dev, int *id) return NULL; name = devm_kstrdup(dev, devname, GFP_KERNEL); + if (!name) + return NULL; /* are we a "%s.%d" name (platform and SPI components) */ found = strstr(name, dev->driver->name);