mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs: take hm->lock in xfs_ioc_health_monitor() before insert
@ 2026-09-06 14:46 Deepanshu Kartikey
  2026-09-07  4:51 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Deepanshu Kartikey @ 2026-09-06 14:46 UTC (permalink / raw)
  To: cem, djwong
  Cc: linux-xfs, linux-kernel, Deepanshu Kartikey, syzbot+ccdf3469f5f653bff7ac

__xfs_healthmon_insert() asserts that hm->lock is held
(lockdep_assert_held), but xfs_ioc_health_monitor() called it right
after allocating hm, before ever taking the lock, triggering a
lockdep warning.

Take hm->lock around the call.

Fixes: b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
index 3ae5f4496ad1..2f762f90d329 100644
--- a/fs/xfs/xfs_healthmon.c
+++ b/fs/xfs/xfs_healthmon.c
@@ -1219,7 +1219,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.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-09-11  7:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06 14:46 [PATCH] xfs: take hm->lock in xfs_ioc_health_monitor() before insert Deepanshu Kartikey
2026-09-07  4:51 ` Darrick J. Wong
2026-09-10  5:07   ` Christoph Hellwig
2026-09-10  6:22     ` Carlos Maiolino
2026-09-10  6:23     ` Carlos Maiolino
2026-09-10  9:40     ` Carlos Maiolino
2026-09-10 13:42       ` Shigeru Yoshida
2026-09-10 14:33         ` Carlos Maiolino
2026-09-10  9:11 ` Carlos Maiolino
2026-09-11  7:29 ` Carlos Maiolino

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®