linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Filipe David Borba Manana <fdmanana@gmail.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: add missing sysfs group remove / fix leak
Date: Wed, 20 Nov 2013 13:02:21 -0500	[thread overview]
Message-ID: <528CF92D.6070400@suse.com> (raw)
In-Reply-To: <1384877267-32046-1-git-send-email-fdmanana@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2196 bytes --]

On 11/19/13, 11:07 AM, Filipe David Borba Manana wrote:
> From kmemleak:
> 
>   hex dump (first 32 bytes):
>     03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<ffffffff8175f5f6>] kmemleak_alloc+0x26/0x50
>     [<ffffffff8118f284>] kmem_cache_alloc+0x114/0x200
>     [<ffffffff81219281>] sysfs_new_dirent+0x51/0x130
>     [<ffffffff812196d2>] create_dir+0x42/0xd0
>     [<ffffffff812199ff>] sysfs_create_subdir+0x1f/0x30
>     [<ffffffff8121b50e>] internal_create_group+0x5e/0x270
>     [<ffffffff8121b753>] sysfs_create_group+0x13/0x20
>     [<ffffffffa069c99e>] btrfs_sysfs_add_one+0x7e/0x280 [btrfs]
>     [<ffffffffa0682792>] open_ctree+0x17d2/0x21f0 [btrfs]
>     [<ffffffffa065883a>] btrfs_mount+0x53a/0x7d0 [btrfs]
>     [<ffffffff811a3ad3>] mount_fs+0x43/0x1b0
>     [<ffffffff811bfa56>] vfs_kern_mount+0x76/0x120
>     [<ffffffff811c1d77>] do_mount+0x237/0xa70
>     [<ffffffff811c2640>] SyS_mount+0x90/0xe0
>     [<ffffffff8177ef12>] system_call_fastpath+0x16/0x1b
>     [<ffffffffffffffff>] 0xffffffffffffffff
> unreferenced object 0xffff8804e37d45b8 (size 160):
> 
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
> ---
>  fs/btrfs/sysfs.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index 669fdf7..9576771 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -424,6 +424,8 @@ void btrfs_sysfs_remove_one(struct btrfs_fs_info *fs_info)
>  	kobject_put(fs_info->device_dir_kobj);
>  	kobject_del(fs_info->space_info_kobj);
>  	kobject_put(fs_info->space_info_kobj);
> +	sysfs_remove_group(&fs_info->super_kobj,
> +			   &btrfs_feature_attr_group);
>  	kobject_del(&fs_info->super_kobj);
>  	kobject_put(&fs_info->super_kobj);
>  	wait_for_completion(&fs_info->kobj_unregister);
> 

Oops, this isn't actually enough. It'll still leak the unknown feature
attributes, which wouldn't have shown up in your testing. There are a
few other failure cases that need to be handled as well. I'll work up a fix.

-Jeff

-- 
Jeff Mahoney
SUSE Labs


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 841 bytes --]

  parent reply	other threads:[~2013-11-20 18:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 16:07 [PATCH] Btrfs: add missing sysfs group remove / fix leak Filipe David Borba Manana
2013-11-19 16:39 ` Jeff Mahoney
2013-11-20 18:02 ` Jeff Mahoney [this message]
2013-11-20 20:51   ` Filipe David Manana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528CF92D.6070400@suse.com \
    --to=jeffm@suse.com \
    --cc=fdmanana@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).