Re: [PATCH v2] ext4: fix off by one issue in alloc_flex_gd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024/9/27 22:14, Eric Sandeen wrote:
On 9/27/24 8:33 AM, libaokun@xxxxxxxxxxxxxxx wrote:
From: Baokun Li <libaokun1@xxxxxxxxxx>

...

Delete the problematic plus 1 to fix the issue, and add a WARN_ON_ONCE()
to prevent the issue from happening again.

Reported-by: Wesley Hershberger <wesley.hershberger@xxxxxxxxxxxxx>
Closes: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2081231
Reported-by: Stéphane Graber <stgraber@xxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/20240925143325.518508-1-aleksandr.mikhalitsyn@xxxxxxxxxxxxx/
Tested-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>
Tested-by: Eric Sandeen <sandeen@xxxxxxxxxx>
The patch has changed a little since I tested, but it still passes my testcase
(as expected, no WARN ON etc) so looks good from that POV, thanks!
-Eric

Hi Eric,

Thanks for testing it again!

The core modification logic remains unchanged from before.
Just added a max_resize_bg variable for exception fixing.

It is necessary to ensure that flex_gd->resize_bg does not exceed the
smaller of flexbg_size and MAX_RESIZE_BG before it is used. So we need
to record max_resize_bg, warn on resize_bg adjustment logic exceptions,
and use max_resize_bg to avoid subsequent resize complaints.


--
With Best Regards,
Baokun Li





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux