diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-20 19:37:48 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-20 19:37:48 -0400 |
commit | ded0160563b045b61e79949f07bed903e98b6528 (patch) | |
tree | 84c4ef3b54ad972a5ccdacdce216eec4ae466697 | |
parent | e8e60b982daa89e2012c12e54395044a919261d0 (diff) |
Update bcachefs sources to 4b5917839c bcachefs: Fix a null ptr deref in check_xattr()
-rw-r--r-- | .bcachefs_revision | 2 | ||||
-rw-r--r-- | libbcachefs/bcachefs.h | 11 | ||||
-rw-r--r-- | libbcachefs/btree_io.c | 2 | ||||
-rw-r--r-- | libbcachefs/fsck.c | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/.bcachefs_revision b/.bcachefs_revision index 1fe076d5..deb0e347 100644 --- a/.bcachefs_revision +++ b/.bcachefs_revision @@ -1 +1 @@ -ee560a3929f32350ed7e04550ad009c58ab73d5e +4b5917839c4b279b303133b87cd94cc1a352a0e6 diff --git a/libbcachefs/bcachefs.h b/libbcachefs/bcachefs.h index 901b6813..82b0706a 100644 --- a/libbcachefs/bcachefs.h +++ b/libbcachefs/bcachefs.h @@ -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) \ diff --git a/libbcachefs/btree_io.c b/libbcachefs/btree_io.c index 71fe6921..c049876e 100644 --- a/libbcachefs/btree_io.c +++ b/libbcachefs/btree_io.c @@ -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); diff --git a/libbcachefs/fsck.c b/libbcachefs/fsck.c index 37ba927c..c07ddfa0 100644 --- a/libbcachefs/fsck.c +++ b/libbcachefs/fsck.c @@ -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; |