linux-stable/fs/fat
OGAWA Hirofumi 0840daeea6 fat: work around race with userspace's read via blockdev while mounting
[ Upstream commit 07bfa4415a ]

If userspace reads the buffer via blockdev while mounting,
sb_getblk()+modify can race with buffer read via blockdev.

For example,

            FS                               userspace
    bh = sb_getblk()
    modify bh->b_data
                                  read
				    ll_rw_block(bh)
				      fill bh->b_data by on-disk data
				      /* lost modified data by FS */
				      set_buffer_uptodate(bh)
    set_buffer_uptodate(bh)

Userspace should not use the blockdev while mounting though, the udev
seems to be already doing this.  Although I think the udev should try to
avoid this, workaround the race by small overhead.

Link: http://lkml.kernel.org/r/87pnk7l3sw.fsf_-_@mail.parknet.co.jp
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Reported-by: Jan Stancek <jstancek@redhat.com>
Tested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-10-07 18:57:14 +02:00
..
cache.c fat: validate ->i_start before using 2018-08-22 10:52:50 -07:00
dir.c fat: work around race with userspace's read via blockdev while mounting 2019-10-07 18:57:14 +02:00
fat.h fat: propagate 64-bit inode timestamps 2018-08-22 10:52:50 -07:00
fatent.c fat: work around race with userspace's read via blockdev while mounting 2019-10-07 18:57:14 +02:00
file.c fs/fat/file.c: issue flush after the writeback of FAT 2019-06-15 11:53:59 +02:00
inode.c fat: propagate 64-bit inode timestamps 2018-08-22 10:52:50 -07:00
Kconfig
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
misc.c fat: propagate 64-bit inode timestamps 2018-08-22 10:52:50 -07:00
namei_msdos.c fat: propagate 64-bit inode timestamps 2018-08-22 10:52:50 -07:00
namei_vfat.c fat: propagate 64-bit inode timestamps 2018-08-22 10:52:50 -07:00
nfs.c