From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C59527F754; Sun, 7 Sep 2025 20:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757275725; cv=none; b=ar8s70eY/ZfRi2jf7HtAzZ75uxdhiV+SDLv6iOO4MEaBUl7o5XPNELn1hB8+5HgidhZa1IbUyzHnxH9FJmuYFJjBo//f/+zAvDTsfj/sWkukegWrkVenE4khAO8QNK7iRWqNJpExMLvzLJa4ywXAsfs24+0vEt5bGLmc0+69d7A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757275725; c=relaxed/simple; bh=QPs10Z9EsajfY40m4yWhbT1M/hFhdc2bN9//1oOSmQU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DVWrHOY9skqYxYecYR4L5VssyENuE56o2wwzU4NFK75KaYBsxPX2tV5w5v2wFOI0OqUpCE1MgU0AI5WXks13QzkrF/McdGSeMBh5qE4j9du8qVpUy9nkMHshdK0p/fD/dDE5TS/WVbyJf2oV0M339rVGTJROyNb24Xnk4HGauLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dfIH4TDQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dfIH4TDQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4054C4CEF0; Sun, 7 Sep 2025 20:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757275725; bh=QPs10Z9EsajfY40m4yWhbT1M/hFhdc2bN9//1oOSmQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dfIH4TDQt/2zkbvv1aXD6uB7sRVGbaoDpYY+OMPhbamzZKatqB6N6syaHxQWyW3gn oh6KYrA8UNs2VPRlOdlfe4cKKMvt9yMJRDkQtsy+pS4hnPc5zvfnUUifiLlgAE4MT3 f0F5Tnl/b8ekAYMhSOFSSiX6Z4uz9BEo3kFtABQQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Miaoqian Lin , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 08/52] mISDN: Fix memory leak in dsp_hwec_enable() Date: Sun, 7 Sep 2025 21:57:28 +0200 Message-ID: <20250907195602.217382097@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250907195601.957051083@linuxfoundation.org> References: <20250907195601.957051083@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miaoqian Lin [ Upstream commit 0704a3da7ce50f972e898bbda88d2692a22922d9 ] 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 c6a502c22999 ("mISDN: Fix memory leak in dsp_pipeline_build()"). Fixes: 9a4381618262 ("mISDN: Remove VLAs") Signed-off-by: Miaoqian Lin Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250828081457.36061-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/isdn/mISDN/dsp_hwec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/isdn/mISDN/dsp_hwec.c b/drivers/isdn/mISDN/dsp_hwec.c index 0b3f29195330a..0cd216e28f009 100644 --- a/drivers/isdn/mISDN/dsp_hwec.c +++ b/drivers/isdn/mISDN/dsp_hwec.c @@ -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, "="); -- 2.50.1