summaryrefslogtreecommitdiff
path: root/drivers/xen
diff options
context:
space:
mode:
authorGuoHan Zhao <zhaoguohan@kylinos.cn>2026-03-25 20:02:46 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-04-02 13:23:32 +0200
commite7ba52b38766936f3e7451f9951e97fd5f6914f8 (patch)
tree73259ffc1419c5ac0ca09c88ec6517f9ab34b2d9 /drivers/xen
parent806d40421a59bf55ddcf8375059825f0057e53ec (diff)
downloadlinux-e7ba52b38766936f3e7451f9951e97fd5f6914f8.tar.gz
linux-e7ba52b38766936f3e7451f9951e97fd5f6914f8.tar.bz2
linux-e7ba52b38766936f3e7451f9951e97fd5f6914f8.zip
xen/privcmd: unregister xenstore notifier on module exit
[ 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>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/privcmd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index b8a546fe7c1e..cbc62f0df11b 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -1764,6 +1764,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);