Re: [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed

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

 



On Fri, Feb 07, 2020 at 05:46:39PM +0800, qiwuchen55@xxxxxxxxx wrote:
> From: chenqiwu <chenqiwu@xxxxxxxxxx>
> 
> There is a potential mem leak when pstore_init_fs failed,
> since the pstore compression maybe unlikey to initialized
> successfully. We must clean up the allocation once this
> unlikey issue happens.
> 
> Signed-off-by: chenqiwu <chenqiwu@xxxxxxxxxx>
> ---
>  fs/pstore/platform.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index d896457..114dbdf15 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -822,10 +822,10 @@ static int __init pstore_init(void)
>  	allocate_buf_for_compression();
>  
>  	ret = pstore_init_fs();
> -	if (ret)
> -		return ret;
> +	if (ret < 0)
> +		free_buf_for_compression();
>  
> -	return 0;
> +	return ret;
>  }
>  late_initcall(pstore_init);
>
Deal all,
Any update about two fixes?

BRs,
Qiwu



[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