summaryrefslogtreecommitdiff
path: root/fs/btrfs/ordered-data.h
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2014-05-27 12:59:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-30 20:12:02 -0700
commit9e22eb8c724a00c0d51f4c0d144c48bd0d108bd2 (patch)
tree37d3e5a6f06324fe643b02ae4c468d3307ab45c0 /fs/btrfs/ordered-data.h
parentf59f14e214d8b3e0779fde70dabed4586e144fd8 (diff)
btrfs: allocate raid type kobjects dynamically
commit c1895442be01c58449e3bf9272f22062a670e08f upstream. We are currently allocating space_info objects in an array when we allocate space_info. When a user does something like: # btrfs balance start -mconvert=raid1 -dconvert=raid1 /mnt # btrfs balance start -mconvert=single -dconvert=single /mnt -f # btrfs balance start -mconvert=raid1 -dconvert=raid1 / We can end up with memory corruption since the kobject hasn't been reinitialized properly and the name pointer was left set. The rationale behind allocating them statically was to avoid creating a separate kobject container that just contained the raid type. It used the index in the array to determine the index. Ultimately, though, this wastes more memory than it saves in all but the most complex scenarios and introduces kobject lifetime questions. This patch allocates the kobjects dynamically instead. Note that we also remove the kobject_get/put of the parent kobject since kobject_add and kobject_del do that internally. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Reported-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs/ordered-data.h')
0 files changed, 0 insertions, 0 deletions