Thread (4 messages) 4 messages, 2 authors, 2011-10-11

Re: [PATCH v3] ext4: fix possible overflow in ext4_trim_fs()

From: Lukas Czerner <hidden>
Date: 2011-10-11 08:13:07

On Mon, 10 Oct 2011, Ted Ts'o wrote:
On Wed, Sep 07, 2011 at 05:52:57PM +0200, Lukas Czerner wrote:
quoted
The overflow can happen when we are calling get_group_no_and_offset()
which stores the result of do_div() in 32 bit long type. However the
result might be bigger than that if big blocknr is passed in. This will
most likely happen when calling FITRIM with the default argument len =
ULLONG_MAX.

Fix this by using "end" variable instead of "start+len" as it is easier
to get right and specifically check that the end is not beyond the end
of the file system, so we are sure that the result of
get_group_no_and_offset() will not overflow. Otherwise truncate it to
the size of the file system.

Signed-off-by: Lukas Czerner <redacted>
Hi Lukas,

Since I've merged the bigalloc patches that uses clusters instead of
blocks for various file system parameters.  I made a quick attempt to
port your patch, and it wasn't obvious (and I don't have your testing
framework).  Could you do me a favor and forward port your patch to
either the dev or master branch on the ext4 github repository?

Thanks!!

					- Ted
Hi Ted,

no problem, I'll do that. Btw, the test case for it is already in
xfstests (260) so I'll mention that in the commit description as well.

Thanks!
-Lukas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help