summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_update_leaf.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-09 15:21:26 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:18 -0400
commit198141e51cc0dadc5ddf7c7fe5e975c3bb6f546b (patch)
tree6ad4a984ed8701b75b61cb42f98b11c12a2fb48f /fs/bcachefs/btree_update_leaf.c
parentbf0fdb4d89bf16bbcd3a0a340a10ffde25b13d57 (diff)
downloadlwn-198141e51cc0dadc5ddf7c7fe5e975c3bb6f546b.tar.gz
lwn-198141e51cc0dadc5ddf7c7fe5e975c3bb6f546b.zip
bcachefs: Fix null ptr deref in fsck_inode_rm()
bch2_btree_delete_range() can split compressed extents, thus needs to pass in a disk reservation when we're operating on extents btrees. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_update_leaf.c')
-rw-r--r--fs/bcachefs/btree_update_leaf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 1079daef4e86..96fc2cd13f21 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1452,6 +1452,8 @@ retry:
(k = bch2_btree_iter_peek(&iter)).k) &&
!(ret = bkey_err(k)) &&
bkey_cmp(iter.pos, end) < 0) {
+ struct disk_reservation disk_res =
+ bch2_disk_reservation_init(trans->c, 0);
struct bkey_i delete;
bkey_init(&delete.k);
@@ -1486,8 +1488,9 @@ retry:
}
ret = bch2_trans_update(trans, &iter, &delete, 0) ?:
- bch2_trans_commit(trans, NULL, journal_seq,
+ bch2_trans_commit(trans, &disk_res, journal_seq,
BTREE_INSERT_NOFAIL);
+ bch2_disk_reservation_put(trans->c, &disk_res);
if (ret)
break;
}