From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Baokun Li <libaokun1@huawei.com>, linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz,
ojaswin@linux.ibm.com, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, yangerkun@huawei.com, yukuai3@huawei.com,
libaokun1@huawei.com
Subject: Re: [PATCH v2 3/3] ext4: avoid overlapping preallocations due to overflow
Date: Tue, 25 Jul 2023 23:00:43 +0530 [thread overview]
Message-ID: <87v8e7c30c.fsf@doe.com> (raw)
In-Reply-To: <20230724121059.11834-4-libaokun1@huawei.com>
Baokun Li <libaokun1@huawei.com> writes:
> Let's say we want to allocate 2 blocks starting from 4294966386, after
> predicting the file size, start is aligned to 4294965248, len is changed
> to 2048, then end = start + size = 0x100000000. Since end is of
> type ext4_lblk_t, i.e. uint, end is truncated to 0.
>
> This causes (pa->pa_lstart >= end) to always hold when checking if the
> current extent to be allocated crosses already preallocated blocks, so the
> resulting ac_g_ex may cross already preallocated blocks. Hence we convert
> the end type to loff_t and use pa_logical_end() to avoid overflow.
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
> fs/ext4/mballoc.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
Looks good to me. Feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
-ritesh
next prev parent reply other threads:[~2023-07-25 17:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 12:10 [PATCH v2 0/3] ext4: fix some ext4_lblk_t overflow issues Baokun Li
2023-07-24 12:10 ` [PATCH v2 1/3] ext4: add two helper functions extent_logical_end() and pa_logical_end() Baokun Li
2023-07-25 17:29 ` Ritesh Harjani
2023-07-26 1:17 ` Baokun Li
2023-08-03 13:58 ` Jan Kara
2023-07-24 12:10 ` [PATCH v2 2/3] ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow Baokun Li
2023-07-25 17:29 ` Ritesh Harjani
2023-08-03 13:58 ` Jan Kara
2023-07-24 12:10 ` [PATCH v2 3/3] ext4: avoid overlapping preallocations " Baokun Li
2023-07-25 17:30 ` Ritesh Harjani [this message]
2023-08-03 13:58 ` Jan Kara
2023-08-03 14:37 ` [PATCH v2 0/3] ext4: fix some ext4_lblk_t overflow issues Theodore Ts'o
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=87v8e7c30c.fsf@doe.com \
--to=ritesh.list@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=libaokun1@huawei.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
/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).