diff options
author | Ahmed Ehab <[email protected]> | 2024-09-22 00:00:36 +0300 |
---|---|---|
committer | Kent Overstreet <[email protected]> | 2024-09-21 14:54:18 -0400 |
commit | 39c3aad43f6f9bcddd660f5874dcd760e8c04a94 (patch) | |
tree | e76fcbf5fe59b623dcef7b16b59dfc7b97e5053a /tools/testing/selftests/bpf/prog_tests/autoload.c | |
parent | 025c55a4c7f11ea38521c6e797f3192ad8768c93 (diff) |
bcachefs: Hold read lock in bch2_snapshot_tree_oldest_subvol()
Syzbot reports a problem that a warning is triggered due to suspicious
use of rcu_dereference_check(). That is triggered by a call of
bch2_snapshot_tree_oldest_subvol().
The cause of the warning is that inside
bch2_snapshot_tree_oldest_subvol(), snapshot_t() is called which calls
rcu_dereference() that requires a read lock to be held. Also, the call
of bch2_snapshot_tree_next() eventually calls snapshot_t().
To fix this, call rcu_read_lock() before calling snapshot_t(). Then,
release the lock after the termination of the while loop.
Reported-by: <[email protected]>
Signed-off-by: Ahmed Ehab <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/autoload.c')
0 files changed, 0 insertions, 0 deletions