[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH7PR20MB59255EF9DFFB022CB1BBB574BF712@PH7PR20MB5925.namprd20.prod.outlook.com>
Date: Thu, 18 Jan 2024 15:52:49 +0800
From: Fullway Wang <fullwaywang@...look.com>
To: broonie@...nel.org,
srinivas.kandagatla@...aro.org,
bgoswami@...cinc.com,
tiwai@...e.com
Cc: linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org,
fullwaywang@...cent.com,
Fullway Wang <fullwaywang@...look.com>
Subject: [PATCH] sound: soc: wcd934x: fix an incorrect use of kstrndup()
In wcd934x_codec_enable_dec(), kstrndup() is used to alloc memory.
However, kmemdup_nul() should be used instead with the size known.
This is similar to CVE-2019-12454 which was fixed in commit
a549881.
Signed-off-by: Fullway Wang <fullwaywang@...look.com>
---
sound/soc/codecs/wcd934x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 1b6e376f3833..4565a0e1877f 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -4990,7 +4990,7 @@ static int wcd934x_codec_enable_dec(struct snd_soc_dapm_widget *w,
char *dec;
u8 hpf_coff_freq;
- widget_name = kstrndup(w->name, 15, GFP_KERNEL);
+ widget_name = kmemdup_nul(w->name, 15, GFP_KERNEL);
if (!widget_name)
return -ENOMEM;
--
2.39.3 (Apple Git-145)
Powered by blists - more mailing lists