]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
bcachefs: Fix snapshot_t() usage in bch2_fs_quota_read_inode()
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 6 May 2024 02:56:54 +0000 (22:56 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 6 May 2024 14:58:17 +0000 (10:58 -0400)
bch2_fs_quota_read_inode() wasn't entirely updated to the
bch2_snapshot_tree() helper, which takes rcu lock.

Reported-by: syzbot+a3a9a61224ed3b7f0010@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/quota.c

index e68b34eab90a912a55727b1da0428b3655cb3834..556da07381069539e84d8c9ff91fec93b418c718 100644 (file)
@@ -560,13 +560,11 @@ static int bch2_fs_quota_read_inode(struct btree_trans *trans,
        struct bch_fs *c = trans->c;
        struct bch_inode_unpacked u;
        struct bch_snapshot_tree s_t;
-       int ret;
+       u32 tree = bch2_snapshot_tree(c, k.k->p.snapshot);
 
-       ret = bch2_snapshot_tree_lookup(trans,
-                       bch2_snapshot_tree(c, k.k->p.snapshot), &s_t);
+       int ret = bch2_snapshot_tree_lookup(trans, tree, &s_t);
        bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOENT), c,
-                       "%s: snapshot tree %u not found", __func__,
-                       snapshot_t(c, k.k->p.snapshot)->tree);
+                       "%s: snapshot tree %u not found", __func__, tree);
        if (ret)
                return ret;