diff options
author | Dan Robertson <dan@dlrobertson.com> | 2021-05-12 14:07:57 -0400 |
---|---|---|
committer | Stijn Tintel <stijn@linux-ipv6.be> | 2021-05-24 15:52:06 +0300 |
commit | a727ed240806653f29d64d6e67b762bc23f42e74 (patch) | |
tree | c8327f9fc04556583e109dfd38ee14eaf1bd4704 | |
parent | b1e616b9d32da4148d343f7fe50e0daa0ec32993 (diff) |
bcachefs: Fix possible null deref on mount
Ensure that the block device pointer in a superblock handle is not
null before dereferencing it in bch2_dev_to_fs. The block device pointer
may be null when mounting a new bcachefs filesystem given another mounted
bcachefs filesystem exists that has at least one device that is offline.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Conflicts:
fs/bcachefs/super.c
-rw-r--r-- | fs/bcachefs/super.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index f21426034be5..35039d846fc2 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -110,7 +110,7 @@ struct bch_fs *bch2_bdev_to_fs(struct block_device *bdev) list_for_each_entry(c, &bch_fs_list, list) for_each_member_device_rcu(ca, c, i, NULL) - if (ca->disk_sb.bdev == bdev) { + if (ca->disk_sb.bdev && ca->disk_sb.bdev == bdev) { closure_get(&c->cl); goto found; } |