Skip to content

Commit aaa30b7

Browse files
Yuuoniygregkh
authored andcommitted
mISDN: Fix memory leak in dsp_hwec_enable()
[ Upstream commit 0704a3d ] dsp_hwec_enable() allocates dup pointer by kstrdup(arg), but then it updates dup variable by strsep(&dup, ","). As a result when it calls kfree(dup), the dup variable may be a modified pointer that no longer points to the original allocated memory, causing a memory leak. The issue is the same pattern as fixed in commit c6a502c ("mISDN: Fix memory leak in dsp_pipeline_build()"). Fixes: 9a43816 ("mISDN: Remove VLAs") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250828081457.36061-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f10d3c7 commit aaa30b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/isdn/mISDN/dsp_hwec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg)
5151
goto _do;
5252

5353
{
54-
char *dup, *tok, *name, *val;
54+
char *dup, *next, *tok, *name, *val;
5555
int tmp;
5656

57-
dup = kstrdup(arg, GFP_ATOMIC);
57+
dup = next = kstrdup(arg, GFP_ATOMIC);
5858
if (!dup)
5959
return;
6060

61-
while ((tok = strsep(&dup, ","))) {
61+
while ((tok = strsep(&next, ","))) {
6262
if (!strlen(tok))
6363
continue;
6464
name = strsep(&tok, "=");

0 commit comments

Comments
 (0)