* [PATCH v1] xenbus: Unregister reboot notifier on init failure
@ 2026-08-07 3:23 Yuho Choi
2026-08-13 10:46 ` Juergen Gross
0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-08-07 3:23 UTC (permalink / raw)
To: jgross
Cc: sstabellini, oleksandr_tyshchenko, thorsten.blum, jason.andryuk,
alhouseenyousef, kees, darwi, jpoimboe, xen-devel, linux-kernel,
alhouseenyoursef, Yuho Choi
xs_init() registers xs_reboot_nb before initializing XenStore
communications and starting xenwatch. If either operation fails, the
notifier remains registered and a later initialization attempt can hit a
duplicate registration.
Check the notifier registration result and unregister it on every
subsequent failure path.
Fixes: fd8aa9095a95 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/xen/xenbus/xenbus_xs.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index d1cca4acb6f3..62274d377b3a 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -915,19 +915,27 @@ int xs_init(void)
int err;
struct task_struct *task;
- register_reboot_notifier(&xs_reboot_nb);
+ err = register_reboot_notifier(&xs_reboot_nb);
+ if (err)
+ return err;
/* Initialize the shared memory rings to talk to xenstored */
err = xb_init_comms();
if (err)
- return err;
+ goto err_unregister_reboot_notifier;
task = kthread_run(xenwatch_thread, NULL, "xenwatch");
- if (IS_ERR(task))
- return PTR_ERR(task);
+ if (IS_ERR(task)) {
+ err = PTR_ERR(task);
+ goto err_unregister_reboot_notifier;
+ }
/* shutdown watches for kexec boot */
xs_reset_watches();
return 0;
+
+err_unregister_reboot_notifier:
+ unregister_reboot_notifier(&xs_reboot_nb);
+ return err;
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1] xenbus: Unregister reboot notifier on init failure
2026-08-07 3:23 [PATCH v1] xenbus: Unregister reboot notifier on init failure Yuho Choi
@ 2026-08-13 10:46 ` Juergen Gross
0 siblings, 0 replies; 2+ messages in thread
From: Juergen Gross @ 2026-08-13 10:46 UTC (permalink / raw)
To: Yuho Choi
Cc: sstabellini, oleksandr_tyshchenko, thorsten.blum, jason.andryuk,
alhouseenyousef, kees, darwi, jpoimboe, xen-devel, linux-kernel,
alhouseenyoursef
[-- Attachment #1.1.1: Type: text/plain, Size: 589 bytes --]
On 07.08.26 05:23, Yuho Choi wrote:
> xs_init() registers xs_reboot_nb before initializing XenStore
> communications and starting xenwatch. If either operation fails, the
> notifier remains registered and a later initialization attempt can hit a
> duplicate registration.
>
> Check the notifier registration result and unregister it on every
> subsequent failure path.
>
> Fixes: fd8aa9095a95 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-13 10:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-07 3:23 [PATCH v1] xenbus: Unregister reboot notifier on init failure Yuho Choi
2026-08-13 10:46 ` Juergen Gross
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®