]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
[PATCH] ufs: write to hole in big file
authorEvgeniy Dushistov <dushistov@mail.ru>
Sun, 27 Aug 2006 08:23:45 +0000 (01:23 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 27 Aug 2006 18:01:31 +0000 (11:01 -0700)
commitc37336b078ba9d2ff38c535b194996a7ad6e69f8
tree36bb05432893a6db7620e283ea90e6be2c483363
parent08fb306fe63d98eb86e3b16f4cc21816fa47f18e
[PATCH] ufs: write to hole in big file

On UFS, this scenario:
open(O_TRUNC)
lseek(1024 * 1024 * 80)
write("A")
lseek(1024 * 2)
write("A")

may cause access to invalid address.

This happened because of "goal" is calculated in wrong way in block
allocation path, as I see this problem exists also in 2.4.

We use construction like this i_data[lastfrag], i_data array of pointers to
direct blocks, indirect and so on, it has ceratain size ~20 elements, and
lastfrag may have value for example 40000.

Also this patch fixes related to handling such scenario issues, wrong
zeroing metadata, in case of block(not fragment) allocation, and wrong goal
calculation, when we allocate block

Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/ufs/inode.c