]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xen/privcmd: unregister xenstore notifier on module exit
authorGuoHan Zhao <zhaoguohan@kylinos.cn>
Wed, 25 Mar 2026 12:02:46 +0000 (20:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 11:09:54 +0000 (13:09 +0200)
[ Upstream commit cd7e1fef5a1ca1c4fcd232211962ac2395601636 ]

Commit 453b8fb68f36 ("xen/privcmd: restrict usage in
unprivileged domU") added a xenstore notifier to defer setting the
restriction target until Xenstore is ready.

XEN_PRIVCMD can be built as a module, but privcmd_exit() leaves that
notifier behind. Balance the notifier lifecycle by unregistering it on
module exit.

This is harmless even if xenstore was already ready at registration
time and the notifier was never queued on the chain.

Fixes: 453b8fb68f3641fe ("xen/privcmd: restrict usage in unprivileged domU")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20260325120246.252899-1-zhaoguohan@kylinos.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/xen/privcmd.c

index b366192c77cf19a22ffc57748a3c3cfe708040fb..d7d9d427e51a155e6ed7b4cce656dd46d3e3ecbe 100644 (file)
@@ -1784,6 +1784,9 @@ err_privcmdbuf:
 
 static void __exit privcmd_exit(void)
 {
+       if (!xen_initial_domain())
+               unregister_xenstore_notifier(&xenstore_notifier);
+
        privcmd_ioeventfd_exit();
        privcmd_irqfd_exit();
        misc_deregister(&privcmd_dev);