mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
overlayfs: barriers for opening upper-layer directory
make sure that a) all stores done by opening struct file don't leak past storing the reference in od->upperfile b) the lockless side has read dependency barrier Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
54ef6df3f3
commit
d45f00ae43
1 changed files with 2 additions and 1 deletions
|
@ -454,12 +454,13 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end,
|
||||||
if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) {
|
if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) {
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
|
|
||||||
realfile = od->upperfile;
|
realfile =lockless_dereference(od->upperfile);
|
||||||
if (!realfile) {
|
if (!realfile) {
|
||||||
struct path upperpath;
|
struct path upperpath;
|
||||||
|
|
||||||
ovl_path_upper(dentry, &upperpath);
|
ovl_path_upper(dentry, &upperpath);
|
||||||
realfile = ovl_path_open(&upperpath, O_RDONLY);
|
realfile = ovl_path_open(&upperpath, O_RDONLY);
|
||||||
|
smp_mb__before_spinlock();
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
if (!od->upperfile) {
|
if (!od->upperfile) {
|
||||||
if (IS_ERR(realfile)) {
|
if (IS_ERR(realfile)) {
|
||||||
|
|
Loading…
Reference in a new issue