android_kernel_motorola_sm6375/fs/overlayfs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Miklos Szeredi c4461ca7a8 ovl: fix deadlock in splice write
commit 9b91b6b019fda817eb52f728eb9c79b3579760bc upstream.

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 82a763e61e2b ("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: 82a763e61e2b ("ovl: simplify file splice")
Reported-and-tested-by: [email protected]
Signed-off-by: Miklos Szeredi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-11-17 09:48:49 +01:00
..
copy_up.c ovl: fix missing revert_creds() on error path 2021-05-14 09:44:16 +02:00
dir.c ovl: fix missing negative dentry check in ovl_rename() 2021-10-13 10:08:17 +02:00
export.c ovl: fix uninitialized pointer read in ovl_lookup_real_one() 2021-09-03 10:08:12 +02:00
file.c ovl: fix deadlock in splice write 2021-11-17 09:48:49 +01:00
inode.c
Kconfig
Makefile
namei.c
overlayfs.h
ovl_entry.h
readdir.c
super.c ovl: allow upperdir inside lowerdir 2021-05-07 10:51:38 +02:00
util.c