Commit cd7e1fef authored by GuoHan Zhao's avatar GuoHan Zhao Committed by Juergen Gross
Browse files

xen/privcmd: unregister xenstore notifier on module exit



Commit 453b8fb6 ("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: 453b8fb6 ("xen/privcmd: restrict usage in unprivileged domU")
Signed-off-by: default avatarGuoHan Zhao <zhaoguohan@kylinos.cn>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Message-ID: <20260325120246.252899-1-zhaoguohan@kylinos.cn>
parent 0138af24
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1765,6 +1765,9 @@ static int __init privcmd_init(void)

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);