diff mbox series

[1/4] ovl: fix memory leak on unlink of indexed file

Message ID 20180918133434.27437-2-amir73il@gmail.com (mailing list archive)
State New, archived
Headers show
Series Assorted overlayfs fixes for 4.19-rc5 | expand

Commit Message

Amir Goldstein Sept. 18, 2018, 1:34 p.m. UTC
Fixes: caf70cb2ba5d ("ovl: cleanup orphan index entries")
Cc: <stable@vger.kernel.org> # v4.13
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/overlayfs/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Greg Kroah-Hartman Sept. 18, 2018, 1:59 p.m. UTC | #1
On Tue, Sep 18, 2018 at 04:34:31PM +0300, Amir Goldstein wrote:
> Fixes: caf70cb2ba5d ("ovl: cleanup orphan index entries")
> Cc: <stable@vger.kernel.org> # v4.13
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  fs/overlayfs/util.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

I know I reject patches without any changelog text present.  Maybe
Miklos is more forgiving than me... :)

greg k-h
Amir Goldstein Sept. 18, 2018, 3:14 p.m. UTC | #2
On Tue, Sep 18, 2018 at 4:59 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Tue, Sep 18, 2018 at 04:34:31PM +0300, Amir Goldstein wrote:
> > Fixes: caf70cb2ba5d ("ovl: cleanup orphan index entries")
> > Cc: <stable@vger.kernel.org> # v4.13
> > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> > ---
> >  fs/overlayfs/util.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
>
> I know I reject patches without any changelog text present.  Maybe
> Miklos is more forgiving than me... :)
>

Well, I did not intend to CC stable at this point, but since I did and since
you chimed in, Miklos, feel free to add to commit message:

The memory leak was detected by kmemleak when running xfstests
overlay/051,053

Thanks,
Amir.
diff mbox series

Patch

diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 8cfb62cc8672..ace4fe4c39a9 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -683,7 +683,7 @@  static void ovl_cleanup_index(struct dentry *dentry)
 	struct dentry *upperdentry = ovl_dentry_upper(dentry);
 	struct dentry *index = NULL;
 	struct inode *inode;
-	struct qstr name;
+	struct qstr name = { };
 	int err;
 
 	err = ovl_get_index_name(lowerdentry, &name);
@@ -726,6 +726,7 @@  static void ovl_cleanup_index(struct dentry *dentry)
 		goto fail;
 
 out:
+	kfree(name.name);
 	dput(index);
 	return;