Update bcachefs sources to 4b5917839c bcachefs: Fix a null ptr deref in check_xattr()

This commit is contained in:
Kent Overstreet 2023-07-20 19:37:48 -04:00
parent e8e60b982d
commit ded0160563
4 changed files with 11 additions and 8 deletions

View File

@ -1 +1 @@
ee560a3929f32350ed7e04550ad009c58ab73d5e
4b5917839c4b279b303133b87cd94cc1a352a0e6

View File

@ -1185,11 +1185,14 @@ static inline bool bch2_dev_exists2(const struct bch_fs *c, unsigned dev)
static inline int bch2_run_explicit_recovery_pass(struct bch_fs *c,
enum bch_recovery_pass pass)
{
BUG_ON(c->curr_recovery_pass < pass);
c->recovery_passes_explicit |= BIT_ULL(pass);
c->curr_recovery_pass = pass;
return -BCH_ERR_restart_recovery;
if (c->curr_recovery_pass >= pass) {
c->curr_recovery_pass = pass;
return -BCH_ERR_restart_recovery;
} else {
return 0;
}
}
#define BKEY_PADDED_ONSTACK(key, pad) \

View File

@ -612,7 +612,7 @@ static int __btree_err(enum btree_err_type type,
case BTREE_ERR_BAD_NODE:
bch2_print_string_as_lines(KERN_ERR, out.buf);
bch2_topology_error(c);
ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_check_topology);
ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_check_topology) ?: -EIO;
break;
case BTREE_ERR_INCOMPATIBLE:
bch2_print_string_as_lines(KERN_ERR, out.buf);

View File

@ -1669,7 +1669,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
if (ret < 0)
goto err;
if (dir->first_this_inode)
if (dir->first_this_inode && dir->inodes.nr)
*hash_info = bch2_hash_info_init(c, &dir->inodes.data[0].inode);
dir->first_this_inode = false;
@ -1846,7 +1846,7 @@ static int check_xattr(struct btree_trans *trans, struct btree_iter *iter,
if (ret)
return ret;
if (inode->first_this_inode)
if (inode->first_this_inode && inode->inodes.nr)
*hash_info = bch2_hash_info_init(c, &inode->inodes.data[0].inode);
inode->first_this_inode = false;