Skip to content

Commit 4bb0fb5

Browse files
committed
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()
2 parents c94eee8 + 5ffdbe8 commit 4bb0fb5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

fs/overlayfs/copy_up.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
8181
if (len == 0)
8282
return 0;
8383

84-
old_file = ovl_path_open(old, O_RDONLY);
84+
old_file = ovl_path_open(old, O_LARGEFILE | O_RDONLY);
8585
if (IS_ERR(old_file))
8686
return PTR_ERR(old_file);
8787

88-
new_file = ovl_path_open(new, O_WRONLY);
88+
new_file = ovl_path_open(new, O_LARGEFILE | O_WRONLY);
8989
if (IS_ERR(new_file)) {
9090
error = PTR_ERR(new_file);
9191
goto out_fput;
@@ -267,7 +267,7 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir,
267267

268268
out_cleanup:
269269
ovl_cleanup(wdir, newdentry);
270-
goto out;
270+
goto out2;
271271
}
272272

273273
/*

fs/overlayfs/inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags)
363363
ovl_path_upper(dentry, &realpath);
364364
}
365365

366+
if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE)
367+
return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags);
368+
366369
return d_backing_inode(realpath.dentry);
367370
}
368371

fs/overlayfs/super.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ static void ovl_put_super(struct super_block *sb)
544544
mntput(ufs->upper_mnt);
545545
for (i = 0; i < ufs->numlower; i++)
546546
mntput(ufs->lower_mnt[i]);
547+
kfree(ufs->lower_mnt);
547548

548549
kfree(ufs->config.lowerdir);
549550
kfree(ufs->config.upperdir);
@@ -1048,6 +1049,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
10481049
oe->lowerstack[i].dentry = stack[i].dentry;
10491050
oe->lowerstack[i].mnt = ufs->lower_mnt[i];
10501051
}
1052+
kfree(stack);
10511053

10521054
root_dentry->d_fsdata = oe;
10531055

0 commit comments

Comments
 (0)