Re: [PATCH] ceph: fix potential memory leak

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

 



On Thu, Mar 1, 2018 at 7:24 AM, Chengguang Xu <cgxu519@xxxxxxxxxx> wrote:
> There is lack of cache destroy operation for ceph_file_cachep
> when failing from fscache register.
>
> Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxx>
> ---
>  fs/ceph/super.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index a62d2a9..564bddc 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -711,14 +711,17 @@ static int __init init_caches(void)
>                 goto bad_dentry;
>
>         ceph_file_cachep = KMEM_CACHE(ceph_file_info, SLAB_MEM_SPREAD);
> -
>         if (!ceph_file_cachep)
>                 goto bad_file;
>
> -       if ((error = ceph_fscache_register()))
> -               goto bad_file;
> +       error = ceph_fscache_register();
> +       if (error)
> +               goto bad_fscache;
>
>         return 0;
> +
> +bad_fscache:
> +       kmem_cache_destroy(ceph_file_cachep);
>  bad_file:
>         kmem_cache_destroy(ceph_dentry_cachep);
>  bad_dentry:

Applied.

Thanks,

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



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux