diff options
| author | Binbin Deng <18983559317@163.com> | 2026-10-15 16:02:25 +0800 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-11-02 12:02:12 +0100 |
| commit | 0344a9492efac4c79202a07cf284a382f7054170 (patch) | |
| tree | 0535871f2f79fb821f317825d572dddc56115dfb /include/linux/timerqueue.h | |
| parent | 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 (diff) | |
xfs: set healthmon mount cookie before publishing it
xfs_ioc_health_monitor() allocates the healthmon object with kzalloc(), so
mount_cookie starts as zero. zero is also DETACHED_MOUNT_COOKIE, but
xfs_healthmon_attach() publishes hm through mp->m_healthmon before storing
the mount cookie. A concurrent reporter can therefore acquire hm from
xfs_healthmon_get(), see the detached cookie in xfs_healthmon_push(), and
drop the event even though the monitor is being attached.
This is reachable by racing XFS_IOC_HEALTH_MONITOR with an operation
that reports a health event, such as a filesystem shutdown. Initialize
the mount cookie before making hm visible through the RCU pointer so
reporters always observe an attached monitor.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: a48373e7d35a ("xfs: start creating infrastructure for health monitoring")
Cc: stable@vger.kernel.org
Signed-off-by: Binbin Deng <18983559317@163.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
