From: syzbot <syzbot+ccdf3469f5f653bff7ac@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] xfs: take hm->lock around __xfs_healthmon_insert() callers
Date: Sun, 06 Sep 2026 01:28:08 -0700 [thread overview]
Message-ID: <6a9d2418.0a3344eb.391530.001f.GAE@google.com> (raw)
In-Reply-To: <6a9acfb3.d07ac993.c20e9.0000.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] xfs: take hm->lock around __xfs_healthmon_insert() callers
Author: kartikey406@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
__xfs_healthmon_insert() asserts that hm->lock is held, but both of
its callers invoked it without the lock held:
- xfs_ioc_health_monitor() inserted the initial RUNNING event right
after allocating hm, before ever taking the lock.
- xfs_healthmon_unmount() inserted the UNMOUNT event on an already
published, shared hm without locking it, racing against
concurrent event producers on the same monitor.
Take hm->lock around both calls.
Reported-by: syzbot+ccdf3469f5f653bff7ac@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=ccdf3469f5f653bff7ac
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
fs/xfs/xfs_healthmon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
index 4521ffdab9f1..762f4ce820c8 100644
--- a/fs/xfs/xfs_healthmon.c
+++ b/fs/xfs/xfs_healthmon.c
@@ -415,8 +415,10 @@ xfs_healthmon_unmount(
* There's nothing actionable for userspace after an unmount. Once
* we've inserted the unmount event, hm no longer owns that event.
*/
+ mutex_lock(&hm->lock);
__xfs_healthmon_insert(hm, hm->unmount_event);
hm->unmount_event = NULL;
+ mutex_unlock(&hm->lock);
xfs_healthmon_detach(hm);
xfs_healthmon_put(hm);
@@ -1213,7 +1215,9 @@ xfs_ioc_health_monitor(
}
running_event->type = XFS_HEALTHMON_RUNNING;
running_event->domain = XFS_HEALTHMON_MOUNT;
+ mutex_lock(&hm->lock);
__xfs_healthmon_insert(hm, running_event);
+ mutex_unlock(&hm->lock);
/*
* Preallocate the unmount event so that we can't fail to notify the
--
2.43.0
next prev parent reply other threads:[~2026-09-06 8:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 14:03 [syzbot] [xfs?] WARNING in __xfs_healthmon_insert syzbot
2026-09-06 8:28 ` syzbot [this message]
2026-09-06 11:48 ` Forwarded: [PATCH] xfs: take hm->lock in xfs_ioc_health_monitor() before insert syzbot
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=6a9d2418.0a3344eb.391530.001f.GAE@google.com \
--to=syzbot+ccdf3469f5f653bff7ac@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.