]> git.karo-electronics.de Git - karo-tx-linux.git/commit
btrfs: fix leaks during sysfs teardown
authorJeff Mahoney <jeffm@suse.com>
Thu, 21 Nov 2013 15:37:16 +0000 (10:37 -0500)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:19:45 +0000 (13:19 -0800)
commite453d989e0bb33defaaa5be4e9f577cea946e2a6
treef285b20b15933459db0b13282042acf3b0569dbf
parent1b8e5df6d9b676f6d31fb098ffdc7d18732729d7
btrfs: fix leaks during sysfs teardown

Filipe noticed that we were leaking the features attribute group
after umount. His fix of just calling sysfs_remove_group() wasn't enough
since that removes just the supported features and not the unsupported
features.

This patch changes the unknown feature handling to add them individually
so we can skip the kmalloc and uses the same iteration to tear them down
later.

We also fix the error handling during mount so that we catch the
failing creation of the per-super kobject, and handle proper teardown
of a half-setup sysfs context.

Tested properly with kmemleak enabled this time.

Reported-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/sysfs.c