summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/snapshot.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-04-17 22:38:14 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-04-20 19:41:38 -0400
commitaa6a591f0fd740e27c54110f8425b53133ad4165 (patch)
treedacf5fba06ba554015c301948be669df101d2f4c /fs/bcachefs/snapshot.c
parentbcachefs: Fix early startup error path (diff)
downloadlinux-aa6a591f0fd740e27c54110f8425b53133ad4165.tar.gz
linux-aa6a591f0fd740e27c54110f8425b53133ad4165.zip
bcachefs: Fix null ptr deref in bch2_snapshot_tree_oldest_subvol()
Reported-by: syzbot+baee8591f336cab0958b@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/snapshot.c')
-rw-r--r--fs/bcachefs/snapshot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index b7de29aed839..fec569c7deb1 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -396,7 +396,7 @@ u32 bch2_snapshot_tree_oldest_subvol(struct bch_fs *c, u32 snapshot_root)
u32 subvol = 0, s;
rcu_read_lock();
- while (id) {
+ while (id && bch2_snapshot_exists(c, id)) {
s = snapshot_t(c, id)->subvol;
if (s && (!subvol || s < subvol))