linux-stable/fs/gfs2
Tuo Li 42077d4de4 gfs2: Fix possible data races in gfs2_show_options()
[ Upstream commit 6fa0a72cbb ]

Some fields such as gt_logd_secs of the struct gfs2_tune are accessed
without holding the lock gt_spin in gfs2_show_options():

  val = sdp->sd_tune.gt_logd_secs;
  if (val != 30)
    seq_printf(s, ",commit=%d", val);

And thus can cause data races when gfs2_show_options() and other functions
such as gfs2_reconfigure() are concurrently executed:

  spin_lock(&gt->gt_spin);
  gt->gt_logd_secs = newargs->ar_commit;

To fix these possible data races, the lock sdp->sd_tune.gt_spin is
acquired before accessing the fields of gfs2_tune and released after these
accesses.

Further changes by Andreas:

- Don't hold the spin lock over the seq_printf operations.

Reported-by: BassCheck <bass@buaa.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-23 17:32:31 +02:00
..
acl.c
acl.h
aops.c - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
aops.h gfs2: Convert gfs2_page_add_databufs to folios 2023-02-22 12:06:20 +01:00
bmap.c gfs2: Eliminate gfs2_trim_blocks 2023-04-18 14:40:12 +02:00
bmap.h gfs2: Eliminate gfs2_trim_blocks 2023-04-18 14:40:12 +02:00
dentry.c Reinstate "GFS2: free disk inode which is deleted by remote node -V2" 2023-03-23 19:37:56 +01:00
dir.c
dir.h
export.c
file.c gfs2: Fix duplicate should_fault_in_pages() call 2023-07-19 16:36:34 +02:00
gfs2.h
glock.c gfs2: Cease delete work during unmount 2023-01-31 22:40:24 +01:00
glock.h gfs2: Split the two kinds of glock "delete" work 2023-01-31 22:40:24 +01:00
glops.c gfs2: gfs2_ail_empty_gl no log flush on error 2023-04-25 11:07:16 +02:00
glops.h
incore.h gfs2: Evict inodes cooperatively 2023-01-31 22:40:24 +01:00
inode.c gfs2: Remove ghs[] from gfs2_unlink 2023-03-27 14:42:16 +02:00
inode.h
Kconfig
lock_dlm.c
log.c - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
log.h
lops.c
lops.h
main.c
Makefile
meta_io.c
meta_io.h
ops_fstype.c gfs2: Use gfs2_holder_initialized for jindex 2023-04-18 14:46:16 +02:00
quota.c
quota.h
recovery.c
recovery.h
rgrp.c gfs2: Split the two kinds of glock "delete" work 2023-01-31 22:40:24 +01:00
rgrp.h
super.c gfs2: Fix possible data races in gfs2_show_options() 2023-08-23 17:32:31 +02:00
super.h
sys.c Driver core changes for 6.3-rc1 2023-02-24 12:58:55 -08:00
sys.h
trace_gfs2.h
trans.c
trans.h
util.c
util.h
xattr.c fs: drop unused posix acl handlers 2023-03-06 09:57:12 +01:00
xattr.h