All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable-commits@vger.kernel.org, 18983559317@163.com
Cc: Amir Goldstein <amir73il@gmail.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	linux-xfs@vger.kernel.org
Subject: Patch "xfs: set healthmon mount cookie before publishing it" has been added to the 7.3-stable tree
Date: Mon,  9 Nov 2026 19:04:44 -0500	[thread overview]
Message-ID: <20261110000444.3481986-1-sashal@kernel.org> (raw)

This is a note to let you know that I've just added the patch titled

    xfs: set healthmon mount cookie before publishing it

to the 7.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xfs-set-healthmon-mount-cookie-before-publishing-it.patch
and it can be found in the queue-7.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.



commit 8b5b37338aa9db56a72115e694a6b4339cdf15ba
Author: Binbin Deng <18983559317@163.com>
Date:   Thu Oct 15 16:02:25 2026 +0800

    xfs: set healthmon mount cookie before publishing it
    
    [ Upstream commit 0344a9492efac4c79202a07cf284a382f7054170 ]
    
    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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
index 2bdd747f1ead2..05d6f0494139d 100644
--- a/fs/xfs/xfs_healthmon.c
+++ b/fs/xfs/xfs_healthmon.c
@@ -114,8 +114,8 @@ xfs_healthmon_attach(
 	}
 
 	refcount_inc(&hm->ref);
-	rcu_assign_pointer(mp->m_healthmon, hm);
 	hm->mount_cookie = (uintptr_t)mp->m_super;
+	rcu_assign_pointer(mp->m_healthmon, hm);
 	spin_unlock(&xfs_healthmon_lock);
 
 	return 0;

                 reply	other threads:[~2026-11-10  0:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261110000444.3481986-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=18983559317@163.com \
    --cc=amir73il@gmail.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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.