From 5a38b440c68ca922a18e6ca4d46b9f0841c2ac2f Mon Sep 17 00:00:00 2001 From: Djalal Harouni Date: Wed, 4 Jan 2012 17:09:52 -0500 Subject: [PATCH] --- yaml --- r: 282979 b: refs/heads/master c: 014a1770371a028d22f364718c805f4216911ecd h: refs/heads/master i: 282977: 41287f1e832e7349d9b6f54f7f1653039db1f609 282975: a84406560399384732594b1ed43b2912053cfaef v: v3 --- [refs] | 2 +- trunk/fs/ext4/ioctl.c | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 5c9effe1b1d1..d97b0feb33ef 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 61f296cc49751f1dc992039229d12b0de7e0c2ae +refs/heads/master: 014a1770371a028d22f364718c805f4216911ecd diff --git a/trunk/fs/ext4/ioctl.c b/trunk/fs/ext4/ioctl.c index c1a98804a383..b81a5f1b6976 100644 --- a/trunk/fs/ext4/ioctl.c +++ b/trunk/fs/ext4/ioctl.c @@ -184,19 +184,22 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (err) return err; - if (get_user(n_blocks_count, (__u32 __user *)arg)) - return -EFAULT; + if (get_user(n_blocks_count, (__u32 __user *)arg)) { + err = -EFAULT; + goto group_extend_out; + } if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { ext4_msg(sb, KERN_ERR, "Online resizing not supported with bigalloc"); - return -EOPNOTSUPP; + err = -EOPNOTSUPP; + goto group_extend_out; } err = mnt_want_write(filp->f_path.mnt); if (err) - return err; + goto group_extend_out; err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count); if (EXT4_SB(sb)->s_journal) { @@ -206,9 +209,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } if (err == 0) err = err2; + mnt_drop_write(filp->f_path.mnt); +group_extend_out: ext4_resize_end(sb); - return err; } @@ -267,19 +271,22 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return err; if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg, - sizeof(input))) - return -EFAULT; + sizeof(input))) { + err = -EFAULT; + goto group_add_out; + } if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { ext4_msg(sb, KERN_ERR, "Online resizing not supported with bigalloc"); - return -EOPNOTSUPP; + err = -EOPNOTSUPP; + goto group_add_out; } err = mnt_want_write(filp->f_path.mnt); if (err) - return err; + goto group_add_out; err = ext4_group_add(sb, &input); if (EXT4_SB(sb)->s_journal) { @@ -289,9 +296,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } if (err == 0) err = err2; + mnt_drop_write(filp->f_path.mnt); +group_add_out: ext4_resize_end(sb); - return err; }