linux/fs/overlayfs
Miklos Szeredi 9b91b6b019 ovl: fix deadlock in splice write
There's possibility of an ABBA deadlock in case of a splice write to an
overlayfs file and a concurrent splice write to a corresponding real file.

The call chain for splice to an overlay file:

 -> do_splice                     [takes sb_writers on overlay file]
   -> do_splice_from
     -> iter_file_splice_write    [takes pipe->mutex]
       -> vfs_iter_write
         ...
         -> ovl_write_iter        [takes sb_writers on real file]

And the call chain for splice to a real file:

 -> do_splice                     [takes sb_writers on real file]
   -> do_splice_from
     -> iter_file_splice_write    [takes pipe->mutex]

Syzbot successfully bisected this to commit 82a763e61e ("ovl: simplify
file splice").

Fix by reverting the write part of the above commit and by adding missing
bits from ovl_write_iter() into ovl_splice_write().

Fixes: 82a763e61e ("ovl: simplify file splice")
Reported-and-tested-by: syzbot+579885d1a9a833336209@syzkaller.appspotmail.com
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2021-08-10 10:21:30 +02:00
..
copy_up.c ovl: fix missing revert_creds() on error path 2021-04-12 12:00:36 +02:00
dir.c ovl: stack fileattr ops 2021-04-12 15:04:29 +02:00
export.c ovl: propagate ovl_fs to ovl_decode_real_fh and ovl_encode_real_fh 2020-11-12 11:31:55 +01:00
file.c ovl: fix deadlock in splice write 2021-08-10 10:21:30 +02:00
inode.c overlayfs update for 5.13 2021-04-30 15:17:08 -07:00
Kconfig docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c overlayfs update for 5.13 2021-04-30 15:17:08 -07:00
overlayfs.h overlayfs update for 5.13 2021-04-30 15:17:08 -07:00
ovl_entry.h ovl: implement volatile-specific fsync error behaviour 2021-01-28 10:22:48 +01:00
readdir.c ovl: skip stale entries in merge dir cache iteration 2021-08-10 10:21:30 +02:00
super.c ovl: allow upperdir inside lowerdir 2021-04-12 12:00:37 +02:00
util.c ovl: invalidate readdir cache on changes to dir with origin 2021-04-12 12:00:37 +02:00