Re: [PATCH] ovl: fix dir cache leak for ovl_cache_get

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

 



On Thu, May 4, 2017 at 10:07 AM, Rock Lee <rockdotlee@xxxxxxxxx> wrote:
> In ovl_cache_get, there is a chance that ovl_dentry_version_get and
> cache->version are not equal. Before set the cache to NULL, free it
> first.
>

This is not a leak. dir cache is refcounted and freed on
ovl_dir_{release|reset}() -> ovl_cache_put()

> Signed-off-by: Rock Lee <rockdotlee@xxxxxxxxx>
> ---
>  fs/overlayfs/readdir.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
> index f241b4e..b3af3d3 100644
> --- a/fs/overlayfs/readdir.c
> +++ b/fs/overlayfs/readdir.c
> @@ -331,6 +331,8 @@ static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry)
>                 cache->refcount++;
>                 return cache;
>         }
> +
> +       kfree(cache);
>         ovl_set_dir_cache(dentry, NULL);
>
>         cache = kzalloc(sizeof(struct ovl_dir_cache), GFP_KERNEL);
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux