diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2021-01-05 08:36:11 +0800 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2021-01-28 10:22:48 +0100 |
commit | b854cc659dcb80f172cb35dbedc15d39d49c383f (patch) | |
tree | a6e341ada6aa4808a949c043cad3e7d90cd168b8 /fs/overlayfs/dir.c | |
parent | f2b00be488730522d0fb7a8a5de663febdcefe0a (diff) |
ovl: avoid deadlock on directory ioctl
The function ovl_dir_real_file() currently uses the inode lock to serialize
writes to the od->upperfile field.
However, this function will get called by ovl_ioctl_set_flags(), which
utilizes the inode lock too. In this case ovl_dir_real_file() will try to
claim a lock that is owned by a function in its call stack, which won't get
released before ovl_dir_real_file() returns.
Fix by replacing the open coded compare and exchange by an explicit atomic
op.
Fixes: 61536bed2149 ("ovl: support [S|G]ETFLAGS and FS[S|G]ETXATTR ioctls for directories")
Cc: stable@vger.kernel.org # v5.10
Reported-by: Icenowy Zheng <icenowy@aosc.io>
Tested-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/dir.c')
0 files changed, 0 insertions, 0 deletions