From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Kari Argillander <kari.argillander@gmail.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Cc: <linux-kernel@vger.kernel.org>, <ntfs3@lists.linux.dev>
Subject: Re: [PATCH] fs/ntfs3: Fix integer overflow in ni_fiemap with fiemap_prep()
Date: Thu, 2 Sep 2021 19:23:46 +0300 [thread overview]
Message-ID: <a0ada3ee-3666-17c4-bb4c-12c29121fc54@paragon-software.com> (raw)
In-Reply-To: <20210825182435.1367530-1-kari.argillander@gmail.com>
On 25.08.2021 21:24, Kari Argillander wrote:
> Use fiemap_prep() to check valid flags. It also shrink request scope
> (@len) to what the fs can actually handle.
>
> This address following Smatch static checker warning:
> fs/ntfs3/frecord.c:1894 ni_fiemap()
> warn: potential integer overflow from user 'vbo + len'
>
> Because fiemap_prep() shrinks @len this cannot happened anymore.
>
> Reported-by Dan Carpenter <dan.carpenter@oracle.com>
> Link: lore.kernel.org/ntfs3/20210825080440.GA17407@kili/
>
> Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
> Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
> ---
> fs/ntfs3/file.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> index 59344985c2e8..cb736701f2cc 100644
> --- a/fs/ntfs3/file.c
> +++ b/fs/ntfs3/file.c
> @@ -1210,8 +1210,9 @@ int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
> int err;
> struct ntfs_inode *ni = ntfs_i(inode);
>
> - if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
> - return -EOPNOTSUPP;
> + err = fiemap_prep(inode, fieinfo, start, &len, ~FIEMAP_FLAG_XATTR);
> + if (err)
> + return err;
>
> ni_lock(ni);
>
>
Hello, Dan, Kari!
Thanks for finding and fixing this issue. Applied patch.
prev parent reply other threads:[~2021-09-02 16:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-25 18:24 [PATCH] fs/ntfs3: Fix integer overflow in ni_fiemap with fiemap_prep() Kari Argillander
2021-09-02 16:23 ` Konstantin Komarov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a0ada3ee-3666-17c4-bb4c-12c29121fc54@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=dan.carpenter@oracle.com \
--cc=kari.argillander@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox