Commit 4bb0fb57 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs

Pull overlayfs bug fixes from Miklos Szeredi:
 "This contains fixes for bugs that appeared in earlier kernels (all are
  marked for -stable)"

* 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
  ovl: free lower_mnt array in ovl_put_super
  ovl: free stack of paths in ovl_fill_super
  ovl: fix open in stacked overlay
  ovl: fix dentry reference leak
  ovl: use O_LARGEFILE in ovl_copy_up()
parents c94eee8a 5ffdbe8b
...@@ -81,11 +81,11 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len) ...@@ -81,11 +81,11 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
if (len == 0) if (len == 0)
return 0; return 0;
old_file = ovl_path_open(old, O_RDONLY); old_file = ovl_path_open(old, O_LARGEFILE | O_RDONLY);
if (IS_ERR(old_file)) if (IS_ERR(old_file))
return PTR_ERR(old_file); return PTR_ERR(old_file);
new_file = ovl_path_open(new, O_WRONLY); new_file = ovl_path_open(new, O_LARGEFILE | O_WRONLY);
if (IS_ERR(new_file)) { if (IS_ERR(new_file)) {
error = PTR_ERR(new_file); error = PTR_ERR(new_file);
goto out_fput; goto out_fput;
...@@ -267,7 +267,7 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir, ...@@ -267,7 +267,7 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir,
out_cleanup: out_cleanup:
ovl_cleanup(wdir, newdentry); ovl_cleanup(wdir, newdentry);
goto out; goto out2;
} }
/* /*
......
...@@ -363,6 +363,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags) ...@@ -363,6 +363,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags)
ovl_path_upper(dentry, &realpath); ovl_path_upper(dentry, &realpath);
} }
if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE)
return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags);
return d_backing_inode(realpath.dentry); return d_backing_inode(realpath.dentry);
} }
......
...@@ -544,6 +544,7 @@ static void ovl_put_super(struct super_block *sb) ...@@ -544,6 +544,7 @@ static void ovl_put_super(struct super_block *sb)
mntput(ufs->upper_mnt); mntput(ufs->upper_mnt);
for (i = 0; i < ufs->numlower; i++) for (i = 0; i < ufs->numlower; i++)
mntput(ufs->lower_mnt[i]); mntput(ufs->lower_mnt[i]);
kfree(ufs->lower_mnt);
kfree(ufs->config.lowerdir); kfree(ufs->config.lowerdir);
kfree(ufs->config.upperdir); kfree(ufs->config.upperdir);
...@@ -1048,6 +1049,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1048,6 +1049,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
oe->lowerstack[i].dentry = stack[i].dentry; oe->lowerstack[i].dentry = stack[i].dentry;
oe->lowerstack[i].mnt = ufs->lower_mnt[i]; oe->lowerstack[i].mnt = ufs->lower_mnt[i];
} }
kfree(stack);
root_dentry->d_fsdata = oe; root_dentry->d_fsdata = oe;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment