mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2026-01-06 02:26:17 +00:00
bcachefs: Add missing guard in bch2_snapshot_has_children()
We additionally need to be going inconsistent if passed an invalid snapshot ID; that patch will need more thorough testing. Reported-by: syzbot+1c9fca23fe478633b305@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
6ce26ad376
commit
6d48e61364
@ -176,12 +176,9 @@ static inline bool bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ances
|
||||
|
||||
static inline bool bch2_snapshot_has_children(struct bch_fs *c, u32 id)
|
||||
{
|
||||
const struct snapshot_t *t;
|
||||
bool ret;
|
||||
|
||||
rcu_read_lock();
|
||||
t = snapshot_t(c, id);
|
||||
ret = (t->children[0]|t->children[1]) != 0;
|
||||
const struct snapshot_t *t = snapshot_t(c, id);
|
||||
bool ret = t && (t->children[0]|t->children[1]) != 0;
|
||||
rcu_read_unlock();
|
||||
|
||||
return ret;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user