public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: crquan@gmail.com, linux-kernel@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: Minor kmemleak report via bdev_cache_init
Date: Mon, 12 Jan 2009 15:54:58 -0800	[thread overview]
Message-ID: <20090112155458.d254ac5a.akpm@linux-foundation.org> (raw)
In-Reply-To: <1231266334.21895.25.camel@pc1117.cambridge.arm.com>

On Tue, 06 Jan 2009 18:25:34 +0000
Catalin Marinas <catalin.marinas@arm.com> wrote:

> Hi Denis,
> 
> With the commit c2acf7b908217 (fs/block_dev.c: __read_mostly improvement
> and sb_is_blkdev_sb utilization), the bd_mnt is only local and kmemleak
> reports the corresponding vfsmnt structure as unreferenced (together
> with the duplicated name) since it can no longer track a valid pointer
> to it:
> 
> unreferenced object 0xdf813848 (size 128):                                      
>   comm "swapper", pid 0, jiffies 4294937384                                     
>   backtrace:                                                                    
>     [<c00872c0>] kmemleak_alloc+0x144/0x27c                                     
>     [<c00848c8>] kmem_cache_alloc+0x108/0x13c                                   
>     [<c009fc00>] alloc_vfsmnt+0x20/0x144                                        
>     [<c008bc34>] vfs_kern_mount+0x30/0xac                                       
>     [<c008bccc>] kern_mount_data+0x1c/0x20                                      
>     [<c00104a8>] bdev_cache_init+0x54/0x90                                      
>     [<c000fd7c>] vfs_caches_init+0xfc/0x128                                     
>     [<c0008984>] start_kernel+0x1f8/0x254                                       
> unreferenced object 0xdf8033d0 (size 32):                                       
>   comm "swapper", pid 0, jiffies 4294937384                                     
>   backtrace:                                                                    
>     [<c00872c0>] kmemleak_alloc+0x144/0x27c                                     
>     [<c0085e10>] __kmalloc_track_caller+0x15c/0x194                             
>     [<c0071704>] kstrdup+0x3c/0x58                                              
>     [<c009fc5c>] alloc_vfsmnt+0x7c/0x144                                        
>     [<c008bc34>] vfs_kern_mount+0x30/0xac                                       
>     [<c008bccc>] kern_mount_data+0x1c/0x20                                      
>     [<c00104a8>] bdev_cache_init+0x54/0x90                                      
>     [<c000fd7c>] vfs_caches_init+0xfc/0x128                                     
>     [<c0008984>] start_kernel+0x1f8/0x254                                       
> 
> Can this object be freed (as below) or should I just tell kmemleak to
> ignore it (or is it referenced and that's a kmemleak false positive)?
> 
> 
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 349a26c..78e469c 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -344,6 +344,7 @@ void __init bdev_cache_init(void)
>  	if (IS_ERR(bd_mnt))
>  		panic("Cannot create bdev pseudo-fs");
>  	blockdev_superblock = bd_mnt->mnt_sb;   /* For writeback */
> +	free_vfsmnt(bd_mnt);
>  }
>  

hm, yes, well, we might be able to get away with that - the kernel
holds onto bd_mnt->mnt_sb for internal use for all time, but we don't
directly use that vfsmount for anything after we've constructed
blockdev_superblock.

However there might well be things under blockdev_superblock which point
back at this vfsmount - dunno, I didn't check.



  reply	other threads:[~2009-01-12 23:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-06 18:25 Minor kmemleak report via bdev_cache_init Catalin Marinas
2009-01-12 23:54 ` Andrew Morton [this message]
2009-01-13  6:19   ` Cheng Renquan

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=20090112155458.d254ac5a.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=crquan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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