linux-rockchip/fs/afs
Al Viro fb8b3b44e0 afs: fix __afs_break_callback() / afs_drop_open_mmap() race
[ Upstream commit 275655d3207b9e65d1561bf21c06a622d9ec1d43 ]

In __afs_break_callback() we might check ->cb_nr_mmap and if it's non-zero
do queue_work(&vnode->cb_work).  In afs_drop_open_mmap() we decrement
->cb_nr_mmap and do flush_work(&vnode->cb_work) if it reaches zero.

The trouble is, there's nothing to prevent __afs_break_callback() from
seeing ->cb_nr_mmap before the decrement and do queue_work() after both
the decrement and flush_work().  If that happens, we might be in trouble -
vnode might get freed before the queued work runs.

__afs_break_callback() is always done under ->cb_lock, so let's make
sure that ->cb_nr_mmap can change from non-zero to zero while holding
->cb_lock (the spinlock component of it - it's a seqlock and we don't
need to mess with the counter).

Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-29 17:30:34 +02:00
..
addr_list.c
afs.h
afs_cm.h
afs_fs.h
afs_vl.h
callback.c afs: fix the usage of read_seqbegin_or_lock() in afs_lookup_volume_rcu() 2024-02-05 20:12:48 +00:00
cell.c afs: Fix overwriting of result of DNS query 2024-01-01 12:38:58 +00:00
cmservice.c
dir.c afs: Revert "afs: Hide silly-rename files from userspace" 2024-03-26 18:20:57 -04:00
dir_edit.c
dir_silly.c
dynroot.c afs: Fix dynamic root lookup DNS check 2024-01-01 12:38:57 +00:00
file.c afs: fix __afs_break_callback() / afs_drop_open_mmap() race 2024-08-29 17:30:34 +02:00
flock.c
fs_operation.c
fs_probe.c
fsclient.c
inode.c
internal.h mm, netfs, fscache: stop read optimisation when folio removed from pagecache 2024-01-10 17:10:31 +01:00
Kconfig
main.c
Makefile
misc.c
mntpt.c afs: Don't cross .backup mountpoint from backup volume 2024-06-16 13:41:31 +02:00
proc.c
protocol_afs.h
protocol_uae.h
protocol_yfs.h
rotate.c
rxrpc.c afs: Fix refcount underflow from error handling race 2023-12-20 17:00:15 +01:00
security.c
server.c afs: fix the usage of read_seqbegin_or_lock() in afs_find_server*() 2024-02-05 20:12:48 +00:00
server_list.c
super.c afs: Fix file locking on R/O volumes to operate in local mode 2023-12-03 07:32:08 +01:00
vl_alias.c
vl_list.c
vl_probe.c
vl_rotate.c afs: Return ENOENT if no cell DNS record can be found 2023-12-03 07:32:08 +01:00
vlclient.c
volume.c afs: Increase buffer size in afs_update_volume_status() 2024-03-01 13:26:36 +01:00
write.c
xattr.c
xdr_fs.h
yfsclient.c