Commit 1a44b007 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ovl-fixes-6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs

Pull overlayfs fix from Amir Goldstein:
 "Fix a regression from this merge window"

* tag 'ovl-fixes-6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs:
  ovl: fix dentry reference leak after changes to underlying layers
parents 74d8fc2b 413ba910
...@@ -753,15 +753,16 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c) ...@@ -753,15 +753,16 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
path.dentry = temp; path.dentry = temp;
err = ovl_copy_up_data(c, &path); err = ovl_copy_up_data(c, &path);
/* /*
* We cannot hold lock_rename() throughout this helper, because or * We cannot hold lock_rename() throughout this helper, because of
* lock ordering with sb_writers, which shouldn't be held when calling * lock ordering with sb_writers, which shouldn't be held when calling
* ovl_copy_up_data(), so lock workdir and destdir and make sure that * ovl_copy_up_data(), so lock workdir and destdir and make sure that
* temp wasn't moved before copy up completion or cleanup. * temp wasn't moved before copy up completion or cleanup.
* If temp was moved, abort without the cleanup.
*/ */
ovl_start_write(c->dentry); ovl_start_write(c->dentry);
if (lock_rename(c->workdir, c->destdir) != NULL || if (lock_rename(c->workdir, c->destdir) != NULL ||
temp->d_parent != c->workdir) { temp->d_parent != c->workdir) {
/* temp or workdir moved underneath us? abort without cleanup */
dput(temp);
err = -EIO; err = -EIO;
goto unlock; goto unlock;
} else if (err) { } else if (err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment