From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-unionfs@vger.kernel.org
Subject: [PATCH 1/4] ovl: fix may_write_real() for overlayfs directories
Date: Mon, 25 Sep 2017 12:36:18 +0300 [thread overview]
Message-ID: <1506332181-19319-2-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1506332181-19319-1-git-send-email-amir73il@gmail.com>
Overlayfs directory file_inode() is the overlay inode whether the real
inode is upper or lower.
This fixes a regression in xfstest generic/158.
Fixes: 7c6893e3c9ab ("ovl: don't allow writing ioctl on lower layer")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
fs/namespace.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 54059b142d6b..3b601f115b6c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -468,7 +468,9 @@ static inline int may_write_real(struct file *file)
/* File refers to upper, writable layer? */
upperdentry = d_real(dentry, NULL, 0, D_REAL_UPPER);
- if (upperdentry && file_inode(file) == d_inode(upperdentry))
+ if (upperdentry &&
+ (file_inode(file) == d_inode(upperdentry) ||
+ file_inode(file) == d_inode(dentry)))
return 0;
/* Lower layer: can't write to real file, sorry... */
--
2.7.4
next prev parent reply other threads:[~2017-09-25 9:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-25 9:36 [PATCH 0/4] assorted overlayfs fixes for v4.14-rc3 Amir Goldstein
2017-09-25 9:36 ` Amir Goldstein [this message]
2017-09-25 9:36 ` [PATCH 2/4] ovl: fix error value printed in ovl_lookup_index() Amir Goldstein
2017-09-25 9:36 ` [PATCH 3/4] ovl: fix dput() of ERR_PTR in ovl_cleanup_index() Amir Goldstein
2017-09-25 9:36 ` [PATCH 4/4] ovl: fix dentry leak in ovl_indexdir_cleanup() Amir Goldstein
2017-09-25 14:02 ` [PATCH 5/5] ovl: fix missing unlock_rename() in ovl_do_copy_up() Amir Goldstein
2017-09-25 14:06 ` [PATCH 0/4] assorted overlayfs fixes for v4.14-rc3 Amir Goldstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506332181-19319-2-git-send-email-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).