From: Heiko Carstens <hca@linux.ibm.com>
To: Jiale Yao <yaojiale02@163.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 5/6] s390/dcssblk: initialize device semaphore before sysfs registration
Date: Wed, 28 Oct 2026 08:03:12 +0100 [thread overview]
Message-ID: <20261028070312.8417Af1-hca@linux.ibm.com> (raw)
In-Reply-To: <20261028044828.96177-6-yaojiale02@163.com>
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!
prev parent reply other threads:[~2026-10-28 7:03 UTC|newest]
Thread overview: 4+ 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 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 message]
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=20261028070312.8417Af1-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=stable@vger.kernel.org \
--cc=svens@linux.ibm.com \
--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