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