Skip to content

Commit 1a44b00

Browse files
committed
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
2 parents 74d8fc2 + 413ba91 commit 1a44b00

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/overlayfs/copy_up.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,15 +753,16 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
753753
path.dentry = temp;
754754
err = ovl_copy_up_data(c, &path);
755755
/*
756-
* We cannot hold lock_rename() throughout this helper, because or
756+
* We cannot hold lock_rename() throughout this helper, because of
757757
* lock ordering with sb_writers, which shouldn't be held when calling
758758
* ovl_copy_up_data(), so lock workdir and destdir and make sure that
759759
* temp wasn't moved before copy up completion or cleanup.
760-
* If temp was moved, abort without the cleanup.
761760
*/
762761
ovl_start_write(c->dentry);
763762
if (lock_rename(c->workdir, c->destdir) != NULL ||
764763
temp->d_parent != c->workdir) {
764+
/* temp or workdir moved underneath us? abort without cleanup */
765+
dput(temp);
765766
err = -EIO;
766767
goto unlock;
767768
} else if (err) {

0 commit comments

Comments
 (0)