summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/copy_up.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-09-25 16:39:55 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2017-10-05 15:53:18 +0200
commit5820dc0888d302ac05f8b91ffdf7e4e53b4fbf53 (patch)
treee22ae933b338fe9a51f34cef6658d82484aaff91 /fs/overlayfs/copy_up.c
parentdc7ab6773e8171e07f16fd0df0c5eea28c899503 (diff)
downloadlinux-5820dc0888d302ac05f8b91ffdf7e4e53b4fbf53.tar.gz
linux-5820dc0888d302ac05f8b91ffdf7e4e53b4fbf53.tar.bz2
linux-5820dc0888d302ac05f8b91ffdf7e4e53b4fbf53.zip
ovl: fix missing unlock_rename() in ovl_do_copy_up()
Use the ovl_lock_rename_workdir() helper which requires unlock_rename() only on lock success. Fixes: ("fd210b7d67ee ovl: move copy up lock out") Cc: <stable@vger.kernel.org> # v4.13 Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/copy_up.c')
-rw-r--r--fs/overlayfs/copy_up.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index aad97b30d5e6..c441f9387a1b 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -561,10 +561,8 @@ static int ovl_do_copy_up(struct ovl_copy_up_ctx *c)
c->tmpfile = true;
err = ovl_copy_up_locked(c);
} else {
- err = -EIO;
- if (lock_rename(c->workdir, c->destdir) != NULL) {
- pr_err("overlayfs: failed to lock workdir+upperdir\n");
- } else {
+ err = ovl_lock_rename_workdir(c->workdir, c->destdir);
+ if (!err) {
err = ovl_copy_up_locked(c);
unlock_rename(c->workdir, c->destdir);
}