From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cantor2.suse.de ([195.135.220.15]:38128 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754530Ab3KTSD1 (ORCPT ); Wed, 20 Nov 2013 13:03:27 -0500 Message-ID: <528CF92D.6070400@suse.com> Date: Wed, 20 Nov 2013 13:02:21 -0500 From: Jeff Mahoney MIME-Version: 1.0 To: Filipe David Borba Manana , linux-btrfs@vger.kernel.org Subject: Re: [PATCH] Btrfs: add missing sysfs group remove / fix leak References: <1384877267-32046-1-git-send-email-fdmanana@gmail.com> In-Reply-To: <1384877267-32046-1-git-send-email-fdmanana@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9B69i9PtKIvKgH6EAHtxsCmTT97rx6epn" Sender: linux-btrfs-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9B69i9PtKIvKgH6EAHtxsCmTT97rx6epn Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 11/19/13, 11:07 AM, Filipe David Borba Manana wrote: > From kmemleak: >=20 > 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: > [] kmemleak_alloc+0x26/0x50 > [] kmem_cache_alloc+0x114/0x200 > [] sysfs_new_dirent+0x51/0x130 > [] create_dir+0x42/0xd0 > [] sysfs_create_subdir+0x1f/0x30 > [] internal_create_group+0x5e/0x270 > [] sysfs_create_group+0x13/0x20 > [] btrfs_sysfs_add_one+0x7e/0x280 [btrfs] > [] open_ctree+0x17d2/0x21f0 [btrfs] > [] btrfs_mount+0x53a/0x7d0 [btrfs] > [] mount_fs+0x43/0x1b0 > [] vfs_kern_mount+0x76/0x120 > [] do_mount+0x237/0xa70 > [] SyS_mount+0x90/0xe0 > [] system_call_fastpath+0x16/0x1b > [] 0xffffffffffffffff > unreferenced object 0xffff8804e37d45b8 (size 160): >=20 > Signed-off-by: Filipe David Borba Manana > --- > fs/btrfs/sysfs.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > 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 *f= s_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); >=20 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 f= ix. -Jeff --=20 Jeff Mahoney SUSE Labs --9B69i9PtKIvKgH6EAHtxsCmTT97rx6epn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.19 (Darwin) iQIcBAEBAgAGBQJSjPkwAAoJEB57S2MheeWyLuwP/jMjsmT88mQiKN89tc//ST4o 7xDlWDd4yaqbl+YGjWAa0TK8aLSGvXKjY9xVCifsUCbaQ026W0jAAjpOrWNsLqwr l5M2zCloIvinBLurDjjp32Q/a2rpPkcl7xQtfDvbHxmxLg3yGoKsKpYWL4RfigEY pwIWck8UpN2QY6DdBENvnsnSa02pIYithRLsgnEguEwST9JP4JcGoVN+lewVJx5w hrqqZXiphnjGvSJQ0TuTjQzNdrH7itel2kuctTwyseCk0ULcONlCTdCekV5jWydO ub8e2XSxr3boxRTtGt3luzaIjKBTfca2dI+lnWf+DQV4QH00K80aCu19fiM5+Hee XDAKnzer23iUC90xaMhL6CWU5wG0h1GvFzKo4JCPPVs1/EH6wCOHpEYl+NG8zruv c3ZXiSm1sjCcJz6cOo4AVEXyEDX+csNrFAqXMoII5gj7JsJmQXEMLwsKtd1zg2FQ 4Twgrsklgz99QPR/PP00YtMWLWUQvlPxZ87Cb5PhdMmhESsJ5iUNnflRA8omkIQC jCUT2r3t0Tykar8+IYPBOR648qV1C0A+xcp/uO32yZszG9dW0/uB1djqWQ1htYyg rbeqodMbqPrJB56lM7IDwUxwQbl/CfHxjxLPkX2y1XwK7D39zuRIoCAnE493xWs0 Fd4WU8J+rRLtuw90xiGE =4P+u -----END PGP SIGNATURE----- --9B69i9PtKIvKgH6EAHtxsCmTT97rx6epn--