From: Jiale Yao <yaojiale02@163.com>
To: Justin Sanders <justin@coraid.com>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 1/6] aoe: initialize error message synchronization before registration
Date: Wed, 28 Oct 2026 12:48:21 +0800 [thread overview]
Message-ID: <20261028044828.96177-2-yaojiale02@163.com> (raw)
In-Reply-To: <20261028044828.96177-1-yaojiale02@163.com>
register_chrdev() makes the AoE character device available before the
error message completion and lock are initialized. A userspace access
racing module initialization can therefore use either object before it
is ready.
Initialize both synchronization objects before registering the character
device.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/block/aoe/aoechr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index a42c4bcc85ba..efc09c97ff23 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -288,13 +288,14 @@ aoechr_init(void)
{
int n, i;
+ init_completion(&emsgs_comp);
+ spin_lock_init(&emsgs_lock);
+
n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
if (n < 0) {
printk(KERN_ERR "aoe: can't register char device\n");
return n;
}
- init_completion(&emsgs_comp);
- spin_lock_init(&emsgs_lock);
n = class_register(&aoe_class);
if (n) {
unregister_chrdev(AOE_MAJOR, "aoechr");
@@ -319,4 +320,3 @@ aoechr_exit(void)
class_unregister(&aoe_class);
unregister_chrdev(AOE_MAJOR, "aoechr");
}
-
--
2.34.1
next prev parent reply other threads:[~2026-10-28 4:48 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 ` Jiale Yao [this message]
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
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=20261028044828.96177-2-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=axboe@kernel.dk \
--cc=justin@coraid.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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 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®