[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210524024941.159952-1-wangkefeng.wang@huawei.com>
Date: Mon, 24 May 2021 10:49:41 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>,
"Takashi Iwai" <tiwai@...e.com>
CC: <linux-kernel@...r.kernel.org>, <alsa-devel@...a-project.org>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Hulk Robot <hulkci@...wei.com>
Subject: [PATCH] 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 <dmitry.baryshkov@...aro.org>
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
---
sound/soc/soc-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1c0904acb935..a76974ccfce1 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);
--
2.26.2
Powered by blists - more mailing lists