diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-31 17:49:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-31 17:49:19 -0400 |
commit | 4bb0fb57f3bbe2ed7d4aad75a3c60a051afbd1db (patch) | |
tree | c6ed47f2dd44bc55b5a9616c3587b976fef27cc8 | |
parent | c94eee8a3befe480a1193f2633f16988108393bc (diff) | |
parent | 5ffdbe8bf1e485026e1c7e4714d2841553cf0b40 (diff) |
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()
-rw-r--r-- | fs/overlayfs/copy_up.c | 6 | ||||
-rw-r--r-- | fs/overlayfs/inode.c | 3 | ||||
-rw-r--r-- | fs/overlayfs/super.c | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 84d693d37428..871fcb67be97 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c | |||
@@ -81,11 +81,11 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len) | |||
81 | if (len == 0) | 81 | if (len == 0) |
82 | return 0; | 82 | return 0; |
83 | 83 | ||
84 | old_file = ovl_path_open(old, O_RDONLY); | 84 | old_file = ovl_path_open(old, O_LARGEFILE | O_RDONLY); |
85 | if (IS_ERR(old_file)) | 85 | if (IS_ERR(old_file)) |
86 | return PTR_ERR(old_file); | 86 | return PTR_ERR(old_file); |
87 | 87 | ||
88 | new_file = ovl_path_open(new, O_WRONLY); | 88 | new_file = ovl_path_open(new, O_LARGEFILE | O_WRONLY); |
89 | if (IS_ERR(new_file)) { | 89 | if (IS_ERR(new_file)) { |
90 | error = PTR_ERR(new_file); | 90 | error = PTR_ERR(new_file); |
91 | goto out_fput; | 91 | goto out_fput; |
@@ -267,7 +267,7 @@ out: | |||
267 | 267 | ||
268 | out_cleanup: | 268 | out_cleanup: |
269 | ovl_cleanup(wdir, newdentry); | 269 | ovl_cleanup(wdir, newdentry); |
270 | goto out; | 270 | goto out2; |
271 | } | 271 | } |
272 | 272 | ||
273 | /* | 273 | /* |
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index d9da5a4e9382..ec0c2a050043 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c | |||
@@ -363,6 +363,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags) | |||
363 | ovl_path_upper(dentry, &realpath); | 363 | ovl_path_upper(dentry, &realpath); |
364 | } | 364 | } |
365 | 365 | ||
366 | if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE) | ||
367 | return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags); | ||
368 | |||
366 | return d_backing_inode(realpath.dentry); | 369 | return d_backing_inode(realpath.dentry); |
367 | } | 370 | } |
368 | 371 | ||
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 79073d68b475..e38ee0fed24a 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -544,6 +544,7 @@ static void ovl_put_super(struct super_block *sb) | |||
544 | mntput(ufs->upper_mnt); | 544 | mntput(ufs->upper_mnt); |
545 | for (i = 0; i < ufs->numlower; i++) | 545 | for (i = 0; i < ufs->numlower; i++) |
546 | mntput(ufs->lower_mnt[i]); | 546 | mntput(ufs->lower_mnt[i]); |
547 | kfree(ufs->lower_mnt); | ||
547 | 548 | ||
548 | kfree(ufs->config.lowerdir); | 549 | kfree(ufs->config.lowerdir); |
549 | kfree(ufs->config.upperdir); | 550 | kfree(ufs->config.upperdir); |
@@ -1048,6 +1049,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
1048 | oe->lowerstack[i].dentry = stack[i].dentry; | 1049 | oe->lowerstack[i].dentry = stack[i].dentry; |
1049 | oe->lowerstack[i].mnt = ufs->lower_mnt[i]; | 1050 | oe->lowerstack[i].mnt = ufs->lower_mnt[i]; |
1050 | } | 1051 | } |
1052 | kfree(stack); | ||
1051 | 1053 | ||
1052 | root_dentry->d_fsdata = oe; | 1054 | root_dentry->d_fsdata = oe; |
1053 | 1055 | ||