Skip to content

Commit 349f7db

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 <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6348069 commit 349f7db

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)