Skip to content

Commit

Permalink
ASoC: core: Fix Null-point-dereference in fmt_single_name()
Browse files Browse the repository at this point in the history
commit 41daf6b upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Kefeng Wang authored and gregkh committed Jun 16, 2021
1 parent 02b07dd commit 047fd16
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/soc/soc-core.c
Expand Up @@ -2223,6 +2223,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);
Expand Down

0 comments on commit 047fd16

Please sign in to comment.