Ahmed Ehab 39c3aad43f 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: <syzbot+f7c41a878676b72c16a6@syzkaller.appspotmail.com>
Signed-off-by: Ahmed Ehab <bottaawesome633@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-09-21 14:54:18 -04:00
..
2024-05-29 09:25:15 -07:00
2024-07-18 09:50:08 +02:00
2024-07-15 11:31:32 -07:00
2024-07-15 11:14:59 -07:00
2024-07-15 11:31:32 -07:00
2024-05-13 14:14:05 -07:00
2024-07-15 11:14:59 -07:00
2024-07-26 18:48:12 +08:00
2024-07-17 12:53:47 -07:00
2024-07-23 15:21:19 -07:00
2024-07-15 11:31:32 -07:00
2024-07-19 11:57:55 -07:00
2024-07-09 10:40:03 +02:00
2024-07-15 11:14:59 -07:00
2024-07-15 10:52:51 -07:00
2024-07-27 15:11:59 -07:00
2024-07-15 11:14:59 -07:00
2024-07-15 13:28:14 -07:00
\n
2024-07-17 13:11:42 -07:00
2024-07-23 14:32:21 -07:00
2024-07-15 11:14:59 -07:00
2024-07-17 12:00:49 -07:00
2024-07-22 10:50:18 -07:00
2024-07-18 14:48:11 -07:00
2024-05-28 11:52:53 +02:00
2024-05-28 11:52:49 +02:00
2024-07-27 20:08:07 -07:00
2024-04-23 13:27:43 +02:00
2024-05-28 11:52:45 +02:00
2024-07-15 11:31:32 -07:00
2024-06-25 11:15:48 +02:00
2024-05-02 20:35:57 +02:00
2024-07-23 17:30:42 -07:00
2024-07-15 11:14:59 -07:00
2024-04-25 20:56:20 -07:00
2024-05-10 08:26:31 +02:00
2024-09-09 09:41:47 -04:00
2024-07-15 12:34:01 -07:00
2024-03-11 10:21:06 -07:00
2024-07-15 11:54:04 -07:00
2024-07-24 10:53:13 +02:00
2024-07-18 09:50:08 +02:00
2024-07-15 10:52:51 -07:00
2024-03-12 20:03:34 -07:00
2024-06-20 15:19:17 -06:00
2024-05-02 16:28:20 +02:00
2024-05-24 13:34:07 +02:00
2024-07-15 14:20:22 -07:00
2024-04-10 16:23:02 -06:00