Commit 1a44b007 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -753,15 +753,16 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
	path.dentry = temp;
	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
	 * ovl_copy_up_data(), so lock workdir and destdir and make sure that
	 * temp wasn't moved before copy up completion or cleanup.
	 * If temp was moved, abort without the cleanup.
	 */
	ovl_start_write(c->dentry);
	if (lock_rename(c->workdir, c->destdir) != NULL ||
	    temp->d_parent != c->workdir) {
		/* temp or workdir moved underneath us? abort without cleanup */
		dput(temp);
		err = -EIO;
		goto unlock;
	} else if (err) {