summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-08-05 18:36:13 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:37 +0300
commit86b74451931790eafa018021fe900faea3230189 (patch)
treeff63bc31d99a692256ba8a023828168c87b79a0e /fs/bcachefs/btree_locking.h
parentae33e7a274abe6863bc4a1f4ea1e4c5f65b533f9 (diff)
downloadlinux-86b74451931790eafa018021fe900faea3230189.tar.xz
bcachefs: Fix bch2_btree_trans_to_text()
bch2_btree_trans_to_text() is used to print btree_transactions owned by other threads; thus, it needs to be particularly careful. This fixes a null ptr deref caused by racing with the owning thread changing path->l[].b. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_locking.h')
-rw-r--r--fs/bcachefs/btree_locking.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index 33a69e27c39e..9d4e1a658eef 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -173,7 +173,7 @@ static inline int btree_node_lock_type(struct btree_trans *trans,
trans->locking_btree_id = path->btree_id;
trans->locking_level = level;
trans->locking_lock_type = type;
- trans->locking = b;
+ trans->locking = &b->c;
ret = six_lock_type(&b->c.lock, type, should_sleep_fn, p);
trans->locking = NULL;