mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
mISDN: Fix memory leak in dsp_hwec_enable()
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 commitc6a502c229
("mISDN: Fix memory leak in dsp_pipeline_build()"). Fixes:9a43816182
("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>
This commit is contained in:
parent
8bf935cf78
commit
0704a3da7c
1 changed files with 3 additions and 3 deletions
|
@ -51,14 +51,14 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg)
|
|||
goto _do;
|
||||
|
||||
{
|
||||
char *dup, *tok, *name, *val;
|
||||
char *dup, *next, *tok, *name, *val;
|
||||
int tmp;
|
||||
|
||||
dup = kstrdup(arg, GFP_ATOMIC);
|
||||
dup = next = kstrdup(arg, GFP_ATOMIC);
|
||||
if (!dup)
|
||||
return;
|
||||
|
||||
while ((tok = strsep(&dup, ","))) {
|
||||
while ((tok = strsep(&next, ","))) {
|
||||
if (!strlen(tok))
|
||||
continue;
|
||||
name = strsep(&tok, "=");
|
||||
|
|
Loading…
Add table
Reference in a new issue