summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/qgroup.c
diff options
context:
space:
mode:
authorJan Schmidt2013-05-28 17:47:23 +0200
committerJosef Bacik2013-06-14 17:30:08 +0200
commiteb1716af887375f1e2099f69bb89dfc5bd169bfa (patch)
tree634461e97227d6d75b3e05f47567bd1d1478beb2 /fs/btrfs/qgroup.c
parentBtrfs: fix memory patcher through fs_info->qgroup_ulist (diff)
downloadkernel-qcow2-linux-eb1716af887375f1e2099f69bb89dfc5bd169bfa.tar.gz
kernel-qcow2-linux-eb1716af887375f1e2099f69bb89dfc5bd169bfa.tar.xz
kernel-qcow2-linux-eb1716af887375f1e2099f69bb89dfc5bd169bfa.zip
Btrfs: avoid double free of fs_info->qgroup_ulist
When btrfs_read_qgroup_config or btrfs_quota_enable return non-zero, we've already freed the fs_info->qgroup_ulist. The final btrfs_free_qgroup_config called from quota_disable makes another ulist_free(fs_info->qgroup_ulist) call. We set fs_info->qgroup_ulist to NULL on the mentioned error paths, turning the ulist_free in btrfs_free_qgroup_config into a noop. Cc: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r--fs/btrfs/qgroup.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 74b432d0b703..c6ce64276869 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -430,8 +430,10 @@ out:
}
btrfs_free_path(path);
- if (ret < 0)
+ if (ret < 0) {
ulist_free(fs_info->qgroup_ulist);
+ fs_info->qgroup_ulist = NULL;
+ }
return ret < 0 ? ret : 0;
}
@@ -932,8 +934,10 @@ out_free_root:
kfree(quota_root);
}
out:
- if (ret)
+ if (ret) {
ulist_free(fs_info->qgroup_ulist);
+ fs_info->qgroup_ulist = NULL;
+ }
mutex_unlock(&fs_info->qgroup_ioctl_lock);
return ret;
}