Skip to content

Commit aa6a591

Browse files
author
Kent Overstreet
committed
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>
1 parent 4c0d2c6 commit aa6a591

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/bcachefs/snapshot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ u32 bch2_snapshot_tree_oldest_subvol(struct bch_fs *c, u32 snapshot_root)
396396
u32 subvol = 0, s;
397397

398398
rcu_read_lock();
399-
while (id) {
399+
while (id && bch2_snapshot_exists(c, id)) {
400400
s = snapshot_t(c, id)->subvol;
401401

402402
if (s && (!subvol || s < subvol))

0 commit comments

Comments
 (0)