Blame SOURCES/0030-fs-ntfs3-Fix-integer-overflow-in-ni_fiemap-with-fiem.patch

Kmods SIG 63c143
From d4e8e135a9af7d8d939bba1874ab314322fc2dc2 Mon Sep 17 00:00:00 2001
Kmods SIG 63c143
From: Kari Argillander <kari.argillander@gmail.com>
Kmods SIG 63c143
Date: Wed, 25 Aug 2021 21:24:35 +0300
Kmods SIG 63c143
Subject: [Backport d4e8e135a9af] src: Fix integer overflow in ni_fiemap
Kmods SIG 63c143
 with fiemap_prep()
Kmods SIG 63c143
Kmods SIG 63c143
Use fiemap_prep() to check valid flags. It also shrink request scope
Kmods SIG 63c143
(@len) to what the fs can actually handle.
Kmods SIG 63c143
Kmods SIG 63c143
This address following Smatch static checker warning:
Kmods SIG 63c143
	src/frecord.c:1894 ni_fiemap()
Kmods SIG 63c143
	warn: potential integer overflow from user 'vbo + len'
Kmods SIG 63c143
Kmods SIG 63c143
Because fiemap_prep() shrinks @len this cannot happened anymore.
Kmods SIG 63c143
Kmods SIG 63c143
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Kmods SIG 63c143
Link: lore.kernel.org/ntfs3/20210825080440.GA17407@kili/
Kmods SIG 63c143
Kmods SIG 63c143
Fixes: 4342306f0f0d ("src: Add file operations and implementation")
Kmods SIG 63c143
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Kmods SIG 63c143
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Kmods SIG 63c143
---
Kmods SIG 63c143
 src/file.c | 5 +++--
Kmods SIG 63c143
 1 file changed, 3 insertions(+), 2 deletions(-)
Kmods SIG 63c143
Kmods SIG 63c143
diff --git a/src/file.c b/src/file.c
Kmods SIG 63c143
index 89557d60a9b0f0e657ce9465504b417bbb50ed04..f9c9a8c91b46d6fad597c954c3b4a2cd331ebfb6 100644
Kmods SIG 63c143
--- a/src/file.c
Kmods SIG 63c143
+++ b/src/file.c
Kmods SIG 63c143
@@ -1212,8 +1212,9 @@ int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
Kmods SIG 63c143
 	int err;
Kmods SIG 63c143
 	struct ntfs_inode *ni = ntfs_i(inode);
Kmods SIG 63c143
 
Kmods SIG 63c143
-	if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
Kmods SIG 63c143
-		return -EOPNOTSUPP;
Kmods SIG 63c143
+	err = fiemap_prep(inode, fieinfo, start, &len, ~FIEMAP_FLAG_XATTR);
Kmods SIG 63c143
+	if (err)
Kmods SIG 63c143
+		return err;
Kmods SIG 63c143
 
Kmods SIG 63c143
 	ni_lock(ni);
Kmods SIG 63c143
 
Kmods SIG 63c143
-- 
Kmods SIG 63c143
2.31.1
Kmods SIG 63c143