mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Jiale Yao" <yaojiale02@163.com>,
	"Brad Warrum" <bwarrum@linux.ibm.com>,
	"Ritu Agarwal" <rituagar@linux.ibm.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Bryant G. Ly" <bryantly@linux.vnet.ibm.com>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Adam Reznechek" <adreznec@linux.vnet.ibm.com>,
	"Steven Royer" <seroyer@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 4/6] misc: ibmvmc: initialize HMC state before device registration
Date: Wed, 28 Oct 2026 10:25:43 +0100	[thread overview]
Message-ID: <67391fce-0db5-4ddb-afc4-6db0b82b741f@app.fastmail.com> (raw)
In-Reply-To: <20261028044828.96177-5-yaojiale02@163.com>

On Wed, Oct 28, 2026, at 05:48, Jiale Yao wrote:
> misc_register() exposes the IBM VMC device before the HMC state and
> spinlocks are initialized. A userspace operation racing module
> initialization can therefore access an HMC through an uninitialized
> spinlock.
>
> Initialize all HMC state before registering the misc device.

It took me a bit to understand the exact race, as it's only
ibmvmc_setup_hmc() that has the race, not open(), but this looks
correct.

> Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiale Yao <yaojiale02@163.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

> +	rc = misc_register(&ibmvmc_miscdev);
> +	if (rc) {
> +		pr_err("ibmvmc: misc registration failed\n");
> +		goto misc_register_failed;
> +	}
> +	pr_info("ibmvmc: node %d:%d\n", MISC_MAJOR,
> +		ibmvmc_miscdev.minor);
> +
>  	/* Sanity check module parms */
>  	ibmvmc_scrub_module_parms();

I would probably move it further down, either just before
the vio_register_driver(), or reordering the two and adding
the misc_device last, to make it really clear that it does
not depend on any of those.

      Arnd

  reply	other threads:[~2026-10-28  9:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28  4:48 [PATCH 0/6] Initialize device state before userspace registration Jiale Yao
2026-10-28  4:48 ` [PATCH 1/6] aoe: initialize error message synchronization before registration Jiale Yao
2026-10-28  4:48 ` [PATCH 2/6] bus: fsl-mc: initialize UAPI state before device registration Jiale Yao
2026-10-28  4:48 ` [PATCH 3/6] Drivers: hv: initialize partition table " Jiale Yao
2026-10-28  4:48 ` [PATCH 4/6] misc: ibmvmc: initialize HMC state " Jiale Yao
2026-10-28  9:25   ` Arnd Bergmann [this message]
2026-10-28 10:05   ` Greg Kroah-Hartman
2026-10-28  4:48 ` [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration Jiale Yao
2026-10-28  7:03   ` Heiko Carstens
2026-10-28  4:48 ` [PATCH 6/6] watchdog: rdc321x: initialize device state before registration Jiale Yao
2026-10-28 14:53   ` Guenter Roeck

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=67391fce-0db5-4ddb-afc4-6db0b82b741f@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=adreznec@linux.vnet.ibm.com \
    --cc=bryantly@linux.vnet.ibm.com \
    --cc=bwarrum@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rituagar@linux.ibm.com \
    --cc=seroyer@linux.vnet.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=yaojiale02@163.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

all inboxes | Powered by JetHome®