tools/xenstore: rework node removal
authorJuergen Gross <jgross@suse.com>
Thu, 11 Jun 2020 14:12:42 +0000 (16:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2020 13:06:03 +0000 (14:06 +0100)
commit117521e9c099d92f60753ff2bb30d97eef6e8137
tree1ed28b2c207c77f1616f0233241b366b8b8745fe
parent91992c72ed55185de07f44aacee499954143c9f3
tools/xenstore: rework node removal

Today a Xenstore node is being removed by deleting it from the parent
first and then deleting itself and all its children. This results in
stale entries remaining in the data base in case e.g. a memory
allocation is failing during processing. This would result in the
rather strange behavior to be able to read a node (as its still in the
data base) while not being visible in the tree view of Xenstore.

Fix that by deleting the nodes from the leaf side instead of starting
at the root.

As fire_watches() is now called from _rm() the ctx parameter needs a
const attribute.

This is part of XSA-115.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Paul Durrant <paul@xen.org>
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_watch.c
tools/xenstore/xenstored_watch.h