diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2013-07-13 09:02:54 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 07:57:36 -0400 |
commit | 1e7bac1ef754b3112eb78c64a7382d286e454424 (patch) | |
tree | a129f88c3ef5fe94a0ed42c7b2dc4b00d72df264 | |
parent | 647f63bd363e5f4800bf3e85a613793e1eb4bf25 (diff) |
Btrfs: set qgroup_ulist to be null after calling ulist_free()
We call ulist_free(qgroup_ulist) in btrfs_free_qgroup_config(),
and btrfs_free_qgroup_config() may be called in two cases:
(1)umount filesystem
(2)disabling quota
However, if we firstly disable quota and then umount filesystem,
a double free happens. Fix it.
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r-- | fs/btrfs/qgroup.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 1280eff8af56..64a9e3cb9453 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -460,7 +460,13 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info) | |||
460 | } | 460 | } |
461 | kfree(qgroup); | 461 | kfree(qgroup); |
462 | } | 462 | } |
463 | /* | ||
464 | * we call btrfs_free_qgroup_config() when umounting | ||
465 | * filesystem and disabling quota, so we set qgroup_ulit | ||
466 | * to be null here to avoid double free. | ||
467 | */ | ||
463 | ulist_free(fs_info->qgroup_ulist); | 468 | ulist_free(fs_info->qgroup_ulist); |
469 | fs_info->qgroup_ulist = NULL; | ||
464 | } | 470 | } |
465 | 471 | ||
466 | static int add_qgroup_relation_item(struct btrfs_trans_handle *trans, | 472 | static int add_qgroup_relation_item(struct btrfs_trans_handle *trans, |