diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-26 22:38:22 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-01 02:36:11 +0200 |
commit | 6f5869ffd9f111b81b95b73c6e54f07406591911 (patch) | |
tree | b88cf5c9a71a30b152339eeb0021746e978aa3bf /fs | |
parent | bcachefs: Fix btree node keys accounting in topology repair path (diff) | |
download | linux-6f5869ffd9f111b81b95b73c6e54f07406591911.tar.xz linux-6f5869ffd9f111b81b95b73c6e54f07406591911.zip |
bcachefs: Fix use after free in bch2_check_fix_ptrs()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/btree_gc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index 6d32ac9be243..26e51af9acdc 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -691,12 +691,6 @@ found: } } - ret = bch2_journal_key_insert_take(c, btree_id, level, new); - if (ret) { - kfree(new); - goto err; - } - if (level) bch2_btree_node_update_key_early(trans, btree_id, level - 1, *k, new); @@ -710,6 +704,12 @@ found: bch_info(c, "new key %s", buf.buf); } + ret = bch2_journal_key_insert_take(c, btree_id, level, new); + if (ret) { + kfree(new); + goto err; + } + *k = bkey_i_to_s_c(new); } err: |