summaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-09-18 22:53:43 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2017-10-05 15:53:18 +0200
commit954c736f865d6c0c68ae4263a2f3502ee7c447a3 (patch)
treeb49f8a37ae725797c9eac78c62e1434b2ca2dfed /fs/namespace.c
parent9e66317d3c92ddaab330c125dfe9d06eee268aff (diff)
downloadlinux-954c736f865d6c0c68ae4263a2f3502ee7c447a3.tar.gz
linux-954c736f865d6c0c68ae4263a2f3502ee7c447a3.tar.bz2
linux-954c736f865d6c0c68ae4263a2f3502ee7c447a3.zip
ovl: fix may_write_real() for overlayfs directories
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> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c4
1 files changed, 3 insertions, 1 deletions
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... */