linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ovl: restore vma->vm_file to old file
@ 2021-04-20  2:07 Chengguang Xu
  2021-04-21  9:47 ` Miklos Szeredi
  0 siblings, 1 reply; 6+ messages in thread
From: Chengguang Xu @ 2021-04-20  2:07 UTC (permalink / raw)
  To: miklos; +Cc: linux-unionfs, Chengguang Xu

In the error case of ->mmap() we should also restore vma->vm_file
to old file in order to keep correct file reference in error path.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/overlayfs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 6e454a294046..046a7adb02c5 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -439,6 +439,7 @@ static int ovl_mmap(struct file *file, struct vm_area_struct *vma)
 	if (ret) {
 		/* Drop reference count from new vm_file value */
 		fput(realfile);
+		vma->vm_file = file;
 	} else {
 		/* Drop reference count from previous vm_file value */
 		fput(file);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-21 12:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20  2:07 [PATCH] ovl: restore vma->vm_file to old file Chengguang Xu
2021-04-21  9:47 ` Miklos Szeredi
2021-04-21 11:03   ` Christian König
2021-04-21 11:14     ` Miklos Szeredi
2021-04-21 11:25       ` Christian König
2021-04-21 12:15         ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).