Skip to contentSkip to conversation

ovl-fix-reference-counting-in-ovl_mmap-error-path.patch removed from -mm tree

merged [email protected] 1 participant 1 message May 8, 2021 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: ovl: fix reference counting in ovl_mmap error path
has been removed from the -mm tree. Its filename was
ovl-fix-reference-counting-in-ovl_mmap-error-path.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Christian König <[email protected]>
Subject: ovl: fix reference counting in ovl_mmap error path

mmap_region() now calls fput() on the vma->vm_file.

Fix this by using vma_set_file() so it doesn't need to be handled manually here any more.

Fixes 1527f926fd04 ("mm: mmap: fix fput in error path v2")
Cc Jan Harkes <[email protected]>
Cc Miklos Szeredi <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc <[email protected]> [5.11+]

---

 fs/overlayfs/file.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
fs/overlayfs/file.c renamed from fs/overlayfs/file.c~ovl-fix-reference-counting-in-ovl_mmap-error-path +1 -10
@@ -430,20 +430,11 @@ static int ovl_mmap(struct file *file, s
 	if (WARN_ON(file != vma->vm_file))
 		return -EIO;
 
-	vma->vm_file = get_file(realfile);
+	vma_set_file(vma, realfile);
 
 	old_cred = ovl_override_creds(file_inode(file)->i_sb);
 	ret = call_mmap(vma->vm_file, vma);
 	revert_creds(old_cred);
-
-	if (ret) {
-		/* Drop reference count from new vm_file value */
-		fput(realfile);
-	} else {
-		/* Drop reference count from previous vm_file value */
-		fput(file);
-	}
-
 	ovl_file_accessed(file);
 
 	return ret;

_

Patches currently in -mm which might be from [email protected] are