lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20221220074336.24258-1-jiasheng@iscas.ac.cn>
Date:   Tue, 20 Dec 2022 15:43:36 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     almaz.alexandrovich@...agon-software.com, nathan@...nel.org,
        ndesaulniers@...gle.com, trix@...hat.com
Cc:     ntfs3@...ts.linux.dev, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] fs/ntfs3: Add missing check for kmemdup

Add check for the return value of the kmemdup since
it may return NULL pointer if allocation fails.

Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 fs/ntfs3/fslog.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index 0d611a6c5511..eb7cf8a69607 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -4277,6 +4277,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
 	rec_len -= t32;
 
 	attr_names = kmemdup(Add2Ptr(lrh, t32), rec_len, GFP_NOFS);
+	if (!attr_names) {
+		err = -ENOMEM;
+		goto out;
+	}
 
 	lcb_put(lcb);
 	lcb = NULL;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ