From: GuoHan Zhao Date: Wed, 25 Mar 2026 12:02:46 +0000 (+0800) Subject: xen/privcmd: unregister xenstore notifier on module exit X-Git-Tag: v6.12.80~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33dce5758914b5c6efe2a974581a7719b100efea;p=thirdparty%2Fkernel%2Fstable.git 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 Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20260325120246.252899-1-zhaoguohan@kylinos.cn> Signed-off-by: Sasha Levin --- diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index b366192c77cf1..d7d9d427e51a1 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -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);