diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/ioctl.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index c1a98804a383..b81a5f1b6976 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -184,19 +184,22 @@ setversion_out: | |||
184 | if (err) | 184 | if (err) |
185 | return err; | 185 | return err; |
186 | 186 | ||
187 | if (get_user(n_blocks_count, (__u32 __user *)arg)) | 187 | if (get_user(n_blocks_count, (__u32 __user *)arg)) { |
188 | return -EFAULT; | 188 | err = -EFAULT; |
189 | goto group_extend_out; | ||
190 | } | ||
189 | 191 | ||
190 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, | 192 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, |
191 | EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { | 193 | EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { |
192 | ext4_msg(sb, KERN_ERR, | 194 | ext4_msg(sb, KERN_ERR, |
193 | "Online resizing not supported with bigalloc"); | 195 | "Online resizing not supported with bigalloc"); |
194 | return -EOPNOTSUPP; | 196 | err = -EOPNOTSUPP; |
197 | goto group_extend_out; | ||
195 | } | 198 | } |
196 | 199 | ||
197 | err = mnt_want_write(filp->f_path.mnt); | 200 | err = mnt_want_write(filp->f_path.mnt); |
198 | if (err) | 201 | if (err) |
199 | return err; | 202 | goto group_extend_out; |
200 | 203 | ||
201 | err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count); | 204 | err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count); |
202 | if (EXT4_SB(sb)->s_journal) { | 205 | if (EXT4_SB(sb)->s_journal) { |
@@ -206,9 +209,10 @@ setversion_out: | |||
206 | } | 209 | } |
207 | if (err == 0) | 210 | if (err == 0) |
208 | err = err2; | 211 | err = err2; |
212 | |||
209 | mnt_drop_write(filp->f_path.mnt); | 213 | mnt_drop_write(filp->f_path.mnt); |
214 | group_extend_out: | ||
210 | ext4_resize_end(sb); | 215 | ext4_resize_end(sb); |
211 | |||
212 | return err; | 216 | return err; |
213 | } | 217 | } |
214 | 218 | ||
@@ -267,19 +271,22 @@ mext_out: | |||
267 | return err; | 271 | return err; |
268 | 272 | ||
269 | if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg, | 273 | if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg, |
270 | sizeof(input))) | 274 | sizeof(input))) { |
271 | return -EFAULT; | 275 | err = -EFAULT; |
276 | goto group_add_out; | ||
277 | } | ||
272 | 278 | ||
273 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, | 279 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, |
274 | EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { | 280 | EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { |
275 | ext4_msg(sb, KERN_ERR, | 281 | ext4_msg(sb, KERN_ERR, |
276 | "Online resizing not supported with bigalloc"); | 282 | "Online resizing not supported with bigalloc"); |
277 | return -EOPNOTSUPP; | 283 | err = -EOPNOTSUPP; |
284 | goto group_add_out; | ||
278 | } | 285 | } |
279 | 286 | ||
280 | err = mnt_want_write(filp->f_path.mnt); | 287 | err = mnt_want_write(filp->f_path.mnt); |
281 | if (err) | 288 | if (err) |
282 | return err; | 289 | goto group_add_out; |
283 | 290 | ||
284 | err = ext4_group_add(sb, &input); | 291 | err = ext4_group_add(sb, &input); |
285 | if (EXT4_SB(sb)->s_journal) { | 292 | if (EXT4_SB(sb)->s_journal) { |
@@ -289,9 +296,10 @@ mext_out: | |||
289 | } | 296 | } |
290 | if (err == 0) | 297 | if (err == 0) |
291 | err = err2; | 298 | err = err2; |
299 | |||
292 | mnt_drop_write(filp->f_path.mnt); | 300 | mnt_drop_write(filp->f_path.mnt); |
301 | group_add_out: | ||
293 | ext4_resize_end(sb); | 302 | ext4_resize_end(sb); |
294 | |||
295 | return err; | 303 | return err; |
296 | } | 304 | } |
297 | 305 | ||