From: Edward AD <eadavis@sina.com>
To: syzbot+29c47e9e51895928698c@syzkaller.appspotmail.com
Cc: agruenba@redhat.com, gfs2@lists.linux.dev,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
rpeterso@redhat.com, syzkaller-bugs@googlegroups.com
Subject: [PATCH] gfs2: fix slab uaf in gfs2_qd_dealloc
Date: Tue, 3 Oct 2023 22:24:31 +0800 [thread overview]
Message-ID: <20231003142431.250548-1-eadavis@sina.com> (raw)
In-Reply-To: <000000000000fe5ae806067f6d39@google.com>
There is a probability that gfs2_put_super will first release gfs2_sbd,
and then execute the callback function gfs2_qd_dealloc of call_rcu to call
the already released sbd opportunity.
Therefore, before releasing gfs2_sbd in gfs2_put_super, execute the rcu
callback function gfs2_qd_dealloc by waiting for "sdp->sd_quota_count == 0" to
avoid such issues.
Reported-and-tested-by: syzbot+29c47e9e51895928698c@syzkaller.appspotmail.com
Signed-off-by: Edward AD <eadavis@sina.com>
---
fs/gfs2/super.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 02d93da21b2b..86b68f0eadae 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -649,6 +649,8 @@ static void gfs2_put_super(struct super_block *sb)
/* At this point, we're through participating in the lockspace */
gfs2_sys_fs_del(sdp);
+ wait_event(sdp->sd_kill_wait,
+ atomic_read(&sdp->sd_quota_count) == 0);
free_sbd(sdp);
}
--
2.25.1
prev parent reply other threads:[~2023-10-03 14:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 13:30 [syzbot] [gfs2?] KASAN: slab-use-after-free Write in gfs2_qd_dealloc syzbot
2023-10-03 14:24 ` Edward AD [this message]
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=20231003142431.250548-1-eadavis@sina.com \
--to=eadavis@sina.com \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rpeterso@redhat.com \
--cc=syzbot+29c47e9e51895928698c@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).