mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jiale Yao <yaojiale02@163.com>
Cc: Brad Warrum <bwarrum@linux.ibm.com>,
	Ritu Agarwal <rituagar@linux.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	"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, stable@vger.kernel.org
Subject: Re: [PATCH 4/6] misc: ibmvmc: initialize HMC state before device registration
Date: Wed, 28 Oct 2026 11:05:58 +0100	[thread overview]
Message-ID: <2026102832-spearhead-concur-fbbf@gregkh> (raw)
In-Reply-To: <20261028044828.96177-5-yaojiale02@163.com>

On Wed, Oct 28, 2026 at 12:48:24PM +0800, 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.
> 
> Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
>  drivers/misc/ibmvmc.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
> index 6afef0788b90..d03aeb8dea8f 100644
> --- a/drivers/misc/ibmvmc.c
> +++ b/drivers/misc/ibmvmc.c
> @@ -2366,14 +2366,6 @@ static int __init ibmvmc_module_init(void)
>  	ibmvmc.state = ibmvmc_state_initial;
>  	pr_info("ibmvmc: version %s\n", IBMVMC_DRIVER_VERSION);
>  
> -	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);
> -
>  	/* Initialize data structures */
>  	memset(hmcs, 0, sizeof(struct ibmvmc_hmc) * MAX_HMCS);
>  	for (i = 0; i < MAX_HMCS; i++) {
> @@ -2383,6 +2375,14 @@ static int __init ibmvmc_module_init(void)
>  			hmcs[i].queue_outbound_msgs[j] = VMC_INVALID_BUFFER_ID;
>  	}
>  
> +	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);

Note, when drivers are successful, they are quiet, so this can go away
with an add-on patch.

thanks,

greg k-h

  parent reply	other threads:[~2026-10-28 10:06 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
2026-10-28 10:05   ` Greg Kroah-Hartman [this message]
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=2026102832-spearhead-concur-fbbf@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=adreznec@linux.vnet.ibm.com \
    --cc=arnd@arndb.de \
    --cc=bryantly@linux.vnet.ibm.com \
    --cc=bwarrum@linux.ibm.com \
    --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®