]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ocfs2: fix shift left overflow
authorJoseph Qi <joseph.qi@huawei.com>
Thu, 6 Aug 2015 22:46:48 +0000 (15:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Aug 2015 03:52:22 +0000 (20:52 -0700)
commit4b6bf170e83e666974ce00d7251dd0d4b5ca5439
tree9080c7dd379721cdbbea8e65c34d932a6086384d
parentc42af788a7e6a33ff8d19b964d9e91df204fde9b
ocfs2: fix shift left overflow

commit 32e5a2a2be6b085febaac36efff495ad65a55e6c upstream.

When using a large volume, for example 9T volume with 2T already used,
frequent creation of small files with O_DIRECT when the IO is not
cluster aligned may clear sectors in the wrong place.  This will cause
filesystem corruption.

This is because p_cpos is a u32.  When calculating the corresponding
sector it should be converted to u64 first, otherwise it may overflow.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ocfs2/aops.c