From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+c3a3a153f0190dca5be9@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [btrfs?] KASAN: slab-use-after-free Read in add_delayed_ref
Date: Tue, 15 Oct 2024 17:55:58 +0800 [thread overview]
Message-ID: <tencent_D3FEC641C9842EEB2EE2CC8E67DB86DD9206@qq.com> (raw)
In-Reply-To: <670d3f2c.050a0220.3e960.0066.GAE@google.com>
using delayed_refs->lock to sync btrfs_work_helper and add_delayed_ref
#syz test
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 13c2e00d1270..cb57e65c9872 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -1058,7 +1058,6 @@ static int add_delayed_ref(struct btrfs_trans_handle *trans,
head_ref = new_head_ref;
merged = insert_delayed_ref(trans, head_ref, node);
- spin_unlock(&delayed_refs->lock);
/*
* Need to update the delayed_refs_rsv with any changes we may have
@@ -1073,8 +1072,12 @@ static int add_delayed_ref(struct btrfs_trans_handle *trans,
if (merged)
kmem_cache_free(btrfs_delayed_ref_node_cachep, node);
- if (qrecord_inserted)
- return btrfs_qgroup_trace_extent_post(trans, record, head_ref->bytenr);
+ if (qrecord_inserted) {
+ ret = btrfs_qgroup_trace_extent_post(trans, record, head_ref->bytenr);
+ spin_unlock(&delayed_refs->lock);
+ return ret;
+ }
+ spin_unlock(&delayed_refs->lock);
return 0;
free_record:
next prev parent reply other threads:[~2024-10-15 10:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 15:56 [syzbot] " syzbot
2024-10-14 17:34 ` syzbot
2024-10-15 9:55 ` Edward Adam Davis [this message]
2024-10-15 10:15 ` syzbot
2024-10-15 10:49 ` Edward Adam Davis
2024-10-15 11:14 ` [syzbot] " syzbot
2024-10-15 12:26 ` [PATCH next] btrfs: Accessing head_ref within delayed_refs lock Edward Adam Davis
2024-10-15 12:49 ` Filipe Manana
2024-10-15 16:38 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_D3FEC641C9842EEB2EE2CC8E67DB86DD9206@qq.com \
--to=eadavis@qq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+c3a3a153f0190dca5be9@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®