* [PATCH 0/6] Initialize device state before userspace registration
@ 2026-10-28 4:48 Jiale Yao
2026-10-28 4:48 ` [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration Jiale Yao
0 siblings, 1 reply; 4+ messages in thread
From: Jiale Yao @ 2026-10-28 4:48 UTC (permalink / raw)
To: Justin Sanders, Jens Axboe, Ioana Ciornei, Haiyang Zhang, Wei Liu,
Dexuan Cui, Brad Warrum, Ritu Agarwal, Arnd Bergmann,
Greg Kroah-Hartman, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Wim Van Sebroeck, Guenter Roeck, Laurentiu Tudor,
Anirudh Rayabharam, Mukesh Rathor, Muminul Islam, Nuno Das Neves,
Steven Royer, Adam Reznechek, Bryant G. Ly, Randy Dunlap,
Martin Schwidefsky, Gerald Schaefer, Florian Fainelli,
linux-block, linux-kernel, linuxppc-dev, linux-hyperv, linux-s390,
linux-watchdog
Several drivers register character devices or sysfs attributes before
initializing synchronization objects and related state used by their
userspace entry points. Registration makes those entry points immediately
available, so a concurrent access can reach partially initialized state.
Move each initialization ahead of the corresponding registration. The
patches are independent and cover AoE, fsl-mc, MSHV, IBM VMC, DCSSBLK,
and the RDC321x watchdog.
Jiale Yao (6):
aoe: initialize error message synchronization before registration
bus: fsl-mc: initialize UAPI state before device registration
Drivers: hv: initialize partition table before device registration
misc: ibmvmc: initialize HMC state before device registration
s390/dcssblk: initialize device semaphore before sysfs registration
watchdog: rdc321x: initialize device state before registration
drivers/block/aoe/aoechr.c | 6 +++---
drivers/bus/fsl-mc/fsl-mc-uapi.c | 6 ++----
drivers/hv/mshv_root_main.c | 6 +++---
drivers/misc/ibmvmc.c | 16 ++++++++--------
drivers/s390/block/dcssblk.c | 3 ++-
drivers/watchdog/rdc321x_wdt.c | 12 ++++++------
6 files changed, 24 insertions(+), 25 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration
2026-10-28 4:48 [PATCH 0/6] Initialize device state before userspace registration Jiale Yao
@ 2026-10-28 4:48 ` Jiale Yao
2026-10-28 4:57 ` sashiko-bot
2026-10-28 7:03 ` Heiko Carstens
0 siblings, 2 replies; 4+ messages in thread
From: Jiale Yao @ 2026-10-28 4:48 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Gerald Schaefer,
Martin Schwidefsky, linux-s390, linux-kernel
Cc: stable
device_create_file() makes the add and remove attributes writable before
the device list semaphore is initialized. A sysfs write racing module
initialization can therefore acquire an uninitialized rwsem.
Initialize the semaphore before registering the root device and its
attributes.
Fixes: c369527f18f8 ("[S390] pm: dcssblk power management callbacks.")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/s390/block/dcssblk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index e5a02c2990d0..46dd7eb9ca7d 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -1013,6 +1013,8 @@ dcssblk_init(void)
{
int rc;
+ init_rwsem(&dcssblk_devices_sem);
+
dcssblk_root_dev = root_device_register("dcssblk");
if (IS_ERR(dcssblk_root_dev))
return PTR_ERR(dcssblk_root_dev);
@@ -1026,7 +1028,6 @@ dcssblk_init(void)
if (rc < 0)
goto out_root;
dcssblk_major = rc;
- init_rwsem(&dcssblk_devices_sem);
dcssblk_check_params();
return 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration
2026-10-28 4:48 ` [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration Jiale Yao
@ 2026-10-28 4:57 ` sashiko-bot
2026-10-28 7:03 ` Heiko Carstens
1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-10-28 4:57 UTC (permalink / raw)
To: Jiale Yao, linux-s390
Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger
> device_create_file() makes the add and remove attributes writable before
> the device list semaphore is initialized. A sysfs write racing module
> initialization can therefore acquire an uninitialized rwsem.
>
> Initialize the semaphore before registering the root device and its
> attributes.
>
> Fixes: c369527f18f8 ("[S390] pm: dcssblk power management callbacks.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261028044828.96177-2-yaojiale02@163.com?part=5
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration
2026-10-28 4:48 ` [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration Jiale Yao
2026-10-28 4:57 ` sashiko-bot
@ 2026-10-28 7:03 ` Heiko Carstens
1 sibling, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-10-28 7:03 UTC (permalink / raw)
To: Jiale Yao
Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, Gerald Schaefer, Martin Schwidefsky, linux-s390,
linux-kernel, stable
On Wed, Oct 28, 2026 at 12:48:25PM +0800, Jiale Yao wrote:
> device_create_file() makes the add and remove attributes writable before
> the device list semaphore is initialized. A sysfs write racing module
> initialization can therefore acquire an uninitialized rwsem.
>
> Initialize the semaphore before registering the root device and its
> attributes.
>
> Fixes: c369527f18f8 ("[S390] pm: dcssblk power management callbacks.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
> drivers/s390/block/dcssblk.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
> index e5a02c2990d0..46dd7eb9ca7d 100644
> --- a/drivers/s390/block/dcssblk.c
> +++ b/drivers/s390/block/dcssblk.c
> @@ -1013,6 +1013,8 @@ dcssblk_init(void)
> {
> int rc;
>
> + init_rwsem(&dcssblk_devices_sem);
> +
> dcssblk_root_dev = root_device_register("dcssblk");
> if (IS_ERR(dcssblk_root_dev))
> return PTR_ERR(dcssblk_root_dev);
> @@ -1026,7 +1028,6 @@ dcssblk_init(void)
> if (rc < 0)
> goto out_root;
> dcssblk_major = rc;
> - init_rwsem(&dcssblk_devices_sem);
I changed this to use a static DECLARE_RWSEM() declaration; and also
removed the incorrect Fixes tag - this is probably broken since the
driver exists.
Applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-28 7:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 4:48 [PATCH 0/6] Initialize device state before userspace registration Jiale Yao
2026-10-28 4:48 ` [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration Jiale Yao
2026-10-28 4:57 ` sashiko-bot
2026-10-28 7:03 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox