diff options
author | Zheng Liang <zhengliang6@huawei.com> | 2021-09-24 04:16:27 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-10-13 11:08:17 +0300 |
commit | fab338f33c25c4816ca0b2d83a04a0097c2c4aaf (patch) | |
tree | cc962ecdd6454df41fb3abc101109d1b4629a056 /fs/nfsd/nfsctl.c | |
parent | 4920aae61bd9def1bfe105f396b2253d91f6231c (diff) | |
download | linux-fab338f33c25c4816ca0b2d83a04a0097c2c4aaf.tar.xz |
ovl: fix missing negative dentry check in ovl_rename()
commit a295aef603e109a47af355477326bd41151765b6 upstream.
The following reproducer
mkdir lower upper work merge
touch lower/old
touch lower/new
mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merge
rm merge/new
mv merge/old merge/new & unlink upper/new
may result in this race:
PROCESS A:
rename("merge/old", "merge/new");
overwrite=true,ovl_lower_positive(old)=true,
ovl_dentry_is_whiteout(new)=true -> flags |= RENAME_EXCHANGE
PROCESS B:
unlink("upper/new");
PROCESS A:
lookup newdentry in new_upperdir
call vfs_rename() with negative newdentry and RENAME_EXCHANGE
Fix by adding the missing check for negative newdentry.
Signed-off-by: Zheng Liang <zhengliang6@huawei.com>
Fixes: e9be9d5e76e3 ("overlay filesystem")
Cc: <stable@vger.kernel.org> # v3.18
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/nfsd/nfsctl.c')
0 files changed, 0 insertions, 0 deletions