From: Roman Smirnov <r.smirnov@omp.ru>
To: "jaegeuk@kernel.org" <jaegeuk@kernel.org>,
"chao@kernel.org" <chao@kernel.org>
Cc: "lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>,
Sergey Shtylyov <s.shtylyov@omp.ru>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Karina Yankevich <k.yankevich@omp.ru>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>
Subject: [f2fs-dev] [bug report] fs: f2fs: integer overflow in f2fs_truncate_inode_blocks()
Date: Fri, 22 Mar 2024 09:05:32 +0000 [thread overview]
Message-ID: <085b27fd2b364a3c8c3a9ca77363e246@omp.ru> (raw)
Hello.
There is a possible bug in f2fs_truncate_inode_blocks():
if (err < 0 && err != -ENOENT)
goto fail;
...
offset[1] = 0;
offset[0]++;
nofs += err;
If err = -ENOENT then nofs will sum with an error code,
which is strange behaviour. Also if nofs < ENOENT this will
cause an overflow. err will be equal to -ENOENT with the
following call stack:
truncate_nodes()
f2fs_get_node_page()
__get_node_page()
read_node_page()
It looks like ENOENT processing is missing here. What can you
say about it? How can it be fixed?
Found by Linux Verification Center (linuxtesting.org) with the
Svace static analysis tool.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
reply other threads:[~2024-03-22 9:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=085b27fd2b364a3c8c3a9ca77363e246@omp.ru \
--to=r.smirnov@omp.ru \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=k.yankevich@omp.ru \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=s.shtylyov@omp.ru \
/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;
as well as URLs for NNTP newsgroup(s).