ovl: Put upperdentry if ovl_check_origin() fails
authorVivek Goyal <vgoyal@redhat.com>
Wed, 1 Nov 2017 19:37:22 +0000 (15:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:43 +0000 (08:40 +0000)
commit 5455f92b54e516995a9ca45bbf790d3629c27a93 upstream.

If ovl_check_origin() fails, we should put upperdentry. We have a reference
on it by now. So goto out_put_upper instead of out.

Fixes: a9d019573e88 ("ovl: lookup non-dir copy-up-origin by file handle")
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/overlayfs/namei.c

index a12dc10bf726351a4a47a75f92b66d3b87043174..bc6d5c5a344353b33d2fb0fe5ae97751b45e6421 100644 (file)
@@ -630,7 +630,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
                        err = ovl_check_origin(upperdentry, roe->lowerstack,
                                               roe->numlower, &stack, &ctr);
                        if (err)
-                               goto out;
+                               goto out_put_upper;
                }
 
                if (d.redirect) {