Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2CCD2594BD; Sat, 12 Sep 2026 13:04:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789218257; cv=none; b=ekA11ai+mdtPADT0yAcuTb+GVZjMN2yyPDXewmv8pO5TgpHMEYB8QgApd3qNr53BNy4GUuB6T156iMThM+JBz7Q2vYPVrkWctIhcxCur1XRzXMEbuuII5IZF9g8ibD8ewa70s0HyCAFg3s+ujpF9jUUriABhmZpTajrEe9TzOyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789218257; c=relaxed/simple; bh=p3CL+ug23sK1podbYKUbCMd6z8d1H74/hnl0h1qLLpY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W4FORkYkhtc7WvDFfpV7FGTl800GDkZGgptFKBLI+ZMrtTHRp7gsVIlaG33+o4ksp5dF99aNznIj2FNeA8kYac+djfYRt9t5AAmV0wEFmtKrv1uQYwoyYZPx8RzMYNymW2dLiDAUCUxUIQdw6mtuMeSU3USPhUUOQk15iqheaw0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sU/cc+lJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="sU/cc+lJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B42981F000FF; Sat, 12 Sep 2026 13:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789218255; bh=99aSGlvs4Ex9DPXUJ8ZTLr1YSobNoW7gTT12gJS6XvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sU/cc+lJ3OE6XBj3/LakkJ/nQB9Gz2FypCz37+0voTe57mojo3FqJCyYS/YZoU/ox eUZoJTB7EgJo5ypZBDbIBaZ3uzFUxIwbPVcnaGuuC7HLLeGU9F0hMJdElS/9aUY4nv gEmfnFYZb2caxjmFaRNsYQqFMhmDIYdzh2So/xVU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuho Choi , Juergen Gross , Sasha Levin Subject: [PATCH 6.12 1105/1376] xenbus: Unregister reboot notifier on init failure Date: Sat, 12 Sep 2026 08:58:51 +0200 Message-ID: <20260912065632.187135101@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuho Choi [ Upstream commit d330fb86a7170f845123ae82d95df440fad9b707 ] 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 Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20260807032326.940377-1-dbgh9129@gmail.com> Signed-off-by: Sasha Levin --- 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 dcf9182c8451a..75efacd0125b4 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c @@ -952,19 +952,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.53.0