Skip to content

Commit 7b9c2af

Browse files
GuoHan Zhaogregkh
authored andcommitted
xen/privcmd: unregister xenstore notifier on module exit
[ Upstream commit cd7e1fe ] Commit 453b8fb ("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: 453b8fb ("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>
1 parent 6c55732 commit 7b9c2af

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/xen/privcmd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,9 @@ static int __init privcmd_init(void)
17641764

17651765
static void __exit privcmd_exit(void)
17661766
{
1767+
if (!xen_initial_domain())
1768+
unregister_xenstore_notifier(&xenstore_notifier);
1769+
17671770
privcmd_ioeventfd_exit();
17681771
privcmd_irqfd_exit();
17691772
misc_deregister(&privcmd_dev);

0 commit comments

Comments
 (0)