]> git.baikalelectronics.ru Git - kernel.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)
commitf2d3eb4859f475417826bb798c767e711c16eb1a
treef285b20b15933459db0b13282042acf3b0569dbf
parent2692e57513b5d05719ece640af9560f24bf207d7
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