Re: [PATCH] shmem: fix percpu_counters list corruption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It was my bad.  I had those two chunks of code in a previous version
of the patch but somehow missed them in the final one.

Acked-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>

On Tue, 2010-08-17 at 20:32 -0700, Hugh Dickins wrote:
> list_add() corruption messages reported from shmem_fill_super()'s recently
> introduced percpu_counter_init(): shmem_put_super() needs to remember to
> percpu_counter_destroy().  And also check error from percpu_counter_init().
> 
> Reported to fix oopses in __free_pipe_info() but I cannot work that out!
> 
> Reported-and-bisected-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
> Tested-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> ---
> 
>  mm/shmem.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> --- 2.6.36-rc1/mm/shmem.c	2010-08-16 00:18:01.000000000 -0700
> +++ linux/mm/shmem.c	2010-08-17 14:42:56.000000000 -0700
> @@ -2325,7 +2325,10 @@ static int shmem_show_options(struct seq
>  
>  static void shmem_put_super(struct super_block *sb)
>  {
> -	kfree(sb->s_fs_info);
> +	struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
> +
> +	percpu_counter_destroy(&sbinfo->used_blocks);
> +	kfree(sbinfo);
>  	sb->s_fs_info = NULL;
>  }
>  
> @@ -2367,7 +2370,8 @@ int shmem_fill_super(struct super_block
>  #endif
>  
>  	spin_lock_init(&sbinfo->stat_lock);
> -	percpu_counter_init(&sbinfo->used_blocks, 0);
> +	if (percpu_counter_init(&sbinfo->used_blocks, 0))
> +		goto failed;
>  	sbinfo->free_inodes = sbinfo->max_inodes;
>  
>  	sb->s_maxbytes = SHMEM_MAX_BYTES;


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux