android_kernel_samsung_univ.../fs/ext4
Theodore Ts'o 705912ca95 ext4: teach ext4_ext_find_extent() to free path on error
Right now, there are a places where it is all to easy to leak memory
on an error path, via a usage like this:

	struct ext4_ext_path *path = NULL

	while (...) {
		...
		path = ext4_ext_find_extent(inode, block, path, 0);
		if (IS_ERR(path)) {
			/* oops, if path was non-NULL before the call to
			   ext4_ext_find_extent, we've leaked it!  :-(  */
			...
			return PTR_ERR(path);
		}
		...
	}

Unfortunately, there some code paths where we are doing the following
instead:

	path = ext4_ext_find_extent(inode, block, orig_path, 0);

and where it's important that we _not_ free orig_path in the case
where ext4_ext_find_extent() returns an error.

So change the function signature of ext4_ext_find_extent() so that it
takes a struct ext4_ext_path ** for its third argument, and by
default, on an error, it will free the struct ext4_ext_path, and then
zero out the struct ext4_ext_path * pointer.  In order to avoid
causing problems, we add a flag EXT4_EX_NOFREE_ON_ERR which causes
ext4_ext_find_extent() to use the original behavior of forcing the
caller to deal with freeing the original path pointer on the error
case.

The goal is to get rid of EXT4_EX_NOFREE_ON_ERR entirely, but this
allows for a gentle transition and makes the patches easier to verify.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-01 14:34:09 -04:00
..
acl.c
acl.h
balloc.c
bitmap.c
block_validity.c
dir.c ext4: convert ext4_bread() to use the ERR_PTR convention 2014-08-29 20:52:15 -04:00
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h
ext4.h ext4: teach ext4_ext_find_extent() to free path on error 2014-09-01 14:34:09 -04:00
extents_status.c
extents_status.h
extents.c ext4: teach ext4_ext_find_extent() to free path on error 2014-09-01 14:34:09 -04:00
file.c
fsync.c
hash.c
ialloc.c
indirect.c
inline.c
inode.c ext4: use ext4_update_i_disksize instead of opencoded ones 2014-08-30 23:34:06 -04:00
ioctl.c
Kconfig
Makefile
mballoc.c ext4: fix BUG_ON in mb_free_blocks() 2014-08-23 17:47:28 -04:00
mballoc.h
migrate.c
mmp.c
move_extent.c ext4: teach ext4_ext_find_extent() to free path on error 2014-09-01 14:34:09 -04:00
namei.c ext4: remove a duplicate call in ext4_init_new_dir() 2014-08-29 23:20:44 -04:00
page-io.c
resize.c
super.c ext4: convert ext4_bread() to use the ERR_PTR convention 2014-08-29 20:52:15 -04:00
symlink.c
truncate.h
xattr_security.c
xattr_trusted.c
xattr_user.c
xattr.c
xattr.h