kernel-ark/fs
Anton Altaparmakov 152becd26e [PATCH] Bug in error recovery in fs/buffer.c::__block_prepare_write()
fs/buffer.c::__block_prepare_write() has broken error recovery.  It calls
the get_block() callback with "create = 1" and if that succeeds it
immediately clears buffer_new on the just allocated buffer (which has
buffer_new set).

The bug is that if an error occurs and get_block() returns != 0, we break
from this loop and go into recovery code.  This code has this comment:

/* Error case: */
/*
 * Zero out any newly allocated blocks to avoid exposing stale
 * data.  If BH_New is set, we know that the block was newly
 * allocated in the above loop.
 */

So the intent is obviously good in that it wants to clear just allocated
and hence not zeroed buffers.  However the code recognises allocated
buffers by checking for buffer_new being set.

Unfortunately __block_prepare_write() as discussed above already cleared
buffer_new on all allocated buffers thus no buffers will be cleared during
error recovery and old data will be leaked.

The simplest way I can see to fix this is to make the current recovery code
work by _not_ clearing buffer_new after calling get_block() in
__block_prepare_write().

We cannot safely allow buffer_new buffers to "leak out" of
__block_prepare_write(), thus we simply do a quick loop over the buffers
clearing buffer_new on each of them if it is set just before returning
"success" from __block_prepare_write().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-23 09:45:34 -07:00
..
adfs
affs
afs
autofs
autofs4 [PATCH] autofs4: bad lookup fix 2005-06-21 19:07:35 -07:00
befs
bfs
cifs [CIFS] Fix cifs update of page cache. Write at correct offset when out of memory 2005-06-09 14:44:07 -07:00
coda [PATCH] class: convert the remaining class_simple users in the kernel to usee the new class api 2005-06-20 15:15:11 -07:00
cramfs
debugfs [PATCH] remove duplicate get_dentry functions in various places 2005-06-23 09:45:20 -07:00
devfs
devpts
efs
exportfs
ext2 [PATCH] remove <linux/xattr_acl.h> 2005-06-23 09:45:33 -07:00
ext3 [PATCH] remove <linux/xattr_acl.h> 2005-06-23 09:45:33 -07:00
fat
freevxfs
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs [PATCH] Avoiding mmap fragmentation 2005-06-21 18:46:16 -07:00
isofs [PATCH] isofs: show hidden files, add granularity for assoc/hidden files flags 2005-06-21 19:07:38 -07:00
jbd
jffs
jffs2
jfs [PATCH] remove <linux/xattr_acl.h> 2005-06-23 09:45:33 -07:00
lockd [PATCH] NLM: fix a client-side race on blocking locks. 2005-06-22 16:07:42 -04:00
minix
msdos
ncpfs
nfs [PATCH] Remove f_error field from struct file 2005-06-23 09:45:33 -07:00
nfs_common [PATCH] NFSD: Add server support for NFSv3 ACLs. 2005-06-22 16:07:23 -04:00
nfsd [PATCH] remove <linux/xattr_acl.h> 2005-06-23 09:45:33 -07:00
nls
ntfs
openpromfs
partitions
proc [PATCH] setuid core dump 2005-06-23 09:45:26 -07:00
qnx4
ramfs
reiserfs [PATCH] remove <linux/xattr_acl.h> 2005-06-23 09:45:33 -07:00
romfs
smbfs
sysfs [PATCH] remove duplicate get_dentry functions in various places 2005-06-23 09:45:20 -07:00
sysv
udf
ufs
umsdos
vfat
xfs Merge rsync://oss.sgi.com/git/xfs-2.6 2005-06-21 19:51:18 -07:00
aio.c
attr.c
bad_inode.c
binfmt_aout.c [PATCH] Avoiding mmap fragmentation 2005-06-21 18:46:16 -07:00
binfmt_elf_fdpic.c
binfmt_elf.c [PATCH] Avoiding mmap fragmentation 2005-06-21 18:46:16 -07:00
binfmt_em86.c
binfmt_flat.c [PATCH] binfmt_flat mmap flag fix 2005-06-06 14:57:51 -07:00
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio.c
block_dev.c [PATCH] block: add unlocked_ioctl support for block devices 2005-06-23 09:45:32 -07:00
buffer.c [PATCH] Bug in error recovery in fs/buffer.c::__block_prepare_write() 2005-06-23 09:45:34 -07:00
char_dev.c [PATCH] add check to /proc/devices read routines 2005-06-23 09:45:19 -07:00
compat_ioctl.c
compat.c
dcache.c
dcookies.c
direct-io.c
dnotify.c
dquot.c [PATCH] quota: sanitize dentry handling in vfs_quota_on_mount 2005-06-23 09:45:20 -07:00
eventpoll.c [PATCH] Remove eventpoll macro obfuscation 2005-06-23 09:45:30 -07:00
exec.c [PATCH] setuid core dump 2005-06-23 09:45:26 -07:00
fcntl.c
fifo.c
file_table.c [PATCH] Fix of bogus file max limit messages 2005-06-23 09:45:26 -07:00
file.c
filesystems.c
fs-writeback.c [PATCH] O(1) sb list traversing on syncs 2005-06-23 09:45:27 -07:00
inode.c [PATCH] fix for prune_icache()/forced final iput() races 2005-06-23 09:45:17 -07:00
ioctl.c
Kconfig [PATCH] NFS: Add support for NFSv3 ACLs 2005-06-22 16:07:24 -04:00
Kconfig.binfmt
libfs.c [PATCH] libfs: add simple attribute files 2005-06-20 15:15:30 -07:00
locks.c [PATCH] VFS: Ensure that all the on-stack struct file_lock call fl_release_private 2005-06-22 16:07:40 -04:00
Makefile [PATCH] NFSD: Add server support for NFSv3 ACLs. 2005-06-22 16:07:23 -04:00
mbcache.c
mpage.c
namei.c [PATCH] add some comments to lookup_create() 2005-06-23 09:45:26 -07:00
namespace.c
nfsctl.c
open.c [PATCH] Remove f_error field from struct file 2005-06-23 09:45:33 -07:00
pipe.c
posix_acl.c
quota_v1.c
quota_v2.c
quota.c [PATCH] O(1) sb list traversing on syncs 2005-06-23 09:45:27 -07:00
read_write.c
readdir.c
select.c
seq_file.c
stat.c
super.c [PATCH] O(1) sb list traversing on syncs 2005-06-23 09:45:27 -07:00
xattr_acl.c
xattr.c