[PATCH] ovl: fix dir cache leak for ovl_cache_get

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

 



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.

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