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 886A920316 for ; Mon, 6 Nov 2023 13:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mm8oQzSj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02CCEC433C9; Mon, 6 Nov 2023 13:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1699276583; bh=HuVZM4kqqtRb3g7w+n5fLVtZl3RGPA3MaO0oz3FgH54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mm8oQzSj10Hx5ZhVV2CRdtfF7kktC7ut3FsjwDCfaxSWLpzGzFR2kLU4G/epvJeR3 ZALCfYHgQpm3XSZDWcCB85HWU5AWT29SkfN3ztam2IEjyHZQpZ0+9iAkPBBuy0ZQDt bi/RM4ig8+UnpIaqNVEFM9lYY0Cjb1Db4hqEI4aM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Su Hui , Konstantin Komarov , Sasha Levin Subject: [PATCH 6.5 29/88] fs/ntfs3: Avoid possible memory leak Date: Mon, 6 Nov 2023 14:03:23 +0100 Message-ID: <20231106130306.858524574@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231106130305.772449722@linuxfoundation.org> References: <20231106130305.772449722@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Su Hui [ Upstream commit e4494770a5cad3c9d1d2a65ed15d07656c0d9b82 ] smatch warn: fs/ntfs3/fslog.c:2172 last_log_lsn() warn: possible memory leak of 'page_bufs' Jump to label 'out' to free 'page_bufs' and is more consistent with other code. Signed-off-by: Su Hui Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/fslog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 12f28cdf5c838..98ccb66508583 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -2168,8 +2168,10 @@ static int last_log_lsn(struct ntfs_log *log) if (!page) { page = kmalloc(log->page_size, GFP_NOFS); - if (!page) - return -ENOMEM; + if (!page) { + err = -ENOMEM; + goto out; + } } /* -- 2.42.0