diff options
author | Amir Goldstein <amir73il@gmail.com> | 2017-09-18 22:53:43 +0300 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2017-10-05 16:53:18 +0300 |
commit | 954c736f865d6c0c68ae4263a2f3502ee7c447a3 (patch) | |
tree | b49f8a37ae725797c9eac78c62e1434b2ca2dfed /fs | |
parent | 9e66317d3c92ddaab330c125dfe9d06eee268aff (diff) | |
download | linux-954c736f865d6c0c68ae4263a2f3502ee7c447a3.tar.xz |
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')
-rw-r--r-- | fs/namespace.c | 4 |
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... */ |