Skip to content

Commit 41daf6b

Browse files
Kefeng Wangbroonie
authored andcommitted
ASoC: core: Fix Null-point-dereference in fmt_single_name()
Check the return value of devm_kstrdup() in case of Null-point-dereference. Fixes: 45dd994 ("ASoC: core: remove artificial component and DAI name constraint") Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Link: https://lore.kernel.org/r/20210524024941.159952-1-wangkefeng.wang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent af27025 commit 41daf6b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎sound/soc/soc-core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,8 @@ static char *fmt_single_name(struct device *dev, int *id)
22252225
return NULL;
22262226

22272227
name = devm_kstrdup(dev, devname, GFP_KERNEL);
2228+
if (!name)
2229+
return NULL;
22282230

22292231
/* are we a "%s.%d" name (platform and SPI components) */
22302232
found = strstr(name, dev->driver->name);

0 commit comments

Comments
 (0)