linux/fs/udf
Eric Sandeen 225add6196 [PATCH] udf: initialize parts of inode earlier in create
I saw an oops down this path when trying to create a new file on a UDF
filesystem which was internally marked as readonly, but mounted rw:

udf_create
        udf_new_inode
                new_inode
                        alloc_inode
                        	udf_alloc_inode
                udf_new_block
                        returns EIO due to readonlyness
                iput (on error)
                        udf_put_inode
                                udf_discard_prealloc
                                        udf_next_aext
                                                udf_current_aext
                                                        udf_get_fileshortad
                                                                OOPS

the udf_discard_prealloc() path was examining uninitialized fields of the
udf inode.

udf_discard_prealloc() already has this code to short-circuit the discard
path if no extents are preallocated:

        if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ||
                inode->i_size == UDF_I_LENEXTENTS(inode))
        {
                return;
        }

so if we initialize UDF_I_LENEXTENTS(inode) = 0 earlier in udf_new_inode,
we won't try to free the (not) preallocated blocks, since this will match
the i_size = 0 set when the inode was initialized.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-08-06 08:57:49 -07:00
..
balloc.c
crc.c
dir.c [PATCH] Make most file operations structs in fs/ const 2006-03-28 09:16:06 -08:00
directory.c
ecma_167.h
file.c [PATCH] mark address_space_operations const 2006-06-28 14:59:04 -07:00
fsync.c
ialloc.c [PATCH] udf: initialize parts of inode earlier in create 2006-08-06 08:57:49 -07:00
inode.c [PATCH] mark address_space_operations const 2006-06-28 14:59:04 -07:00
lowlevel.c
Makefile
misc.c
namei.c
osta_udf.h
partition.c
super.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
symlink.c [PATCH] mark address_space_operations const 2006-06-28 14:59:04 -07:00
truncate.c
udf_i.h
udf_sb.h
udfdecl.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
udfend.h
udftime.c
unicode.c