Whamcloud - gitweb
libext2fs: fix potential races in unix_io
authorTheodore Ts'o <tytso@mit.edu>
Sun, 28 Feb 2021 23:52:20 +0000 (18:52 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 1 Mar 2021 00:33:31 +0000 (19:33 -0500)
commitd557b9659ba97e093f842dcc7e2cfe9a7022c674
treea300a430a5725a400d751063c0ac9aafeeb5227e
parente1af249abafbf4b08c5b55cab6a0564170ce0f7d
libext2fs: fix potential races in unix_io

When unix_io does not use pread/pread64 (which is the case the bounce
buffer is in use, either when Direct I/O is in use or the
IO_FLAG_FORCE_BOUNCE in enabled), there are races between the llseek
and and read or write system calls.  Fix this by using the BOUNCE_MTX
so only one thread is using the file descriptor at a time.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/unix_io.c