stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "ovl: fix dentry leak in ovl_indexdir_cleanup()" has been added to the 4.13-stable tree
@ 2017-10-10 15:12 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-10-10 15:12 UTC (permalink / raw)
  To: amir73il, gregkh, mszeredi; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    ovl: fix dentry leak in ovl_indexdir_cleanup()

to the 4.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ovl-fix-dentry-leak-in-ovl_indexdir_cleanup.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From dc7ab6773e8171e07f16fd0df0c5eea28c899503 Mon Sep 17 00:00:00 2001
From: Amir Goldstein <amir73il@gmail.com>
Date: Sun, 24 Sep 2017 22:19:10 +0300
Subject: ovl: fix dentry leak in ovl_indexdir_cleanup()

From: Amir Goldstein <amir73il@gmail.com>

commit dc7ab6773e8171e07f16fd0df0c5eea28c899503 upstream.

index dentry was not released when breaking out of the loop
due to index verification error.

Fixes: 415543d5c64f ("ovl: cleanup bad and stale index entries on mount")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/overlayfs/readdir.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -672,6 +672,7 @@ int ovl_indexdir_cleanup(struct dentry *
 			 struct path *lowerstack, unsigned int numlower)
 {
 	int err;
+	struct dentry *index = NULL;
 	struct inode *dir = dentry->d_inode;
 	struct path path = { .mnt = mnt, .dentry = dentry };
 	LIST_HEAD(list);
@@ -690,8 +691,6 @@ int ovl_indexdir_cleanup(struct dentry *
 
 	inode_lock_nested(dir, I_MUTEX_PARENT);
 	list_for_each_entry(p, &list, l_node) {
-		struct dentry *index;
-
 		if (p->name[0] == '.') {
 			if (p->len == 1)
 				continue;
@@ -701,6 +700,7 @@ int ovl_indexdir_cleanup(struct dentry *
 		index = lookup_one_len(p->name, dentry, p->len);
 		if (IS_ERR(index)) {
 			err = PTR_ERR(index);
+			index = NULL;
 			break;
 		}
 		err = ovl_verify_index(index, lowerstack, numlower);
@@ -712,7 +712,9 @@ int ovl_indexdir_cleanup(struct dentry *
 				break;
 		}
 		dput(index);
+		index = NULL;
 	}
+	dput(index);
 	inode_unlock(dir);
 out:
 	ovl_cache_free(&list);


Patches currently in stable-queue which might be from amir73il@gmail.com are

queue-4.13/ovl-fix-missing-unlock_rename-in-ovl_do_copy_up.patch
queue-4.13/ovl-fix-error-value-printed-in-ovl_lookup_index.patch
queue-4.13/ovl-fix-dput-of-err_ptr-in-ovl_cleanup_index.patch
queue-4.13/ovl-fix-regression-caused-by-exclusive-upper-work-dir-protection.patch
queue-4.13/ovl-fix-dentry-leak-in-ovl_indexdir_cleanup.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-10 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-10 15:12 Patch "ovl: fix dentry leak in ovl_indexdir_cleanup()" has been added to the 4.13-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).