]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Update bcachefs sources to 4b5917839c bcachefs: Fix a null ptr deref in check_xattr()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 20 Jul 2023 23:37:48 +0000 (19:37 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 20 Jul 2023 23:37:48 +0000 (19:37 -0400)
.bcachefs_revision
libbcachefs/bcachefs.h
libbcachefs/btree_io.c
libbcachefs/fsck.c

index 1fe076d534ecba1a217ddfb4b55b389cf28c9f00..deb0e34718d8ebaf7c0888e8c7c3427beac410dc 100644 (file)
@@ -1 +1 @@
-ee560a3929f32350ed7e04550ad009c58ab73d5e
+4b5917839c4b279b303133b87cd94cc1a352a0e6
index 901b681332ecafe3d1f70e0db85450ba873bd0f9..82b0706a89365ee4ebdf2f1a77069c3cab93d2c5 100644 (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)                          \
index 71fe69217caf9ca3113d7a35ef2f9e9d24260f74..c049876ee80be3cc4ca5e7813ddd42e1a9194490 100644 (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);
index 37ba927cbd31e6c571dd3fd197ea1e8ece5067c1..c07ddfa0001dac41026f782c8432c5ad5263a667 100644 (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;