tools/xenstore: dont unlink connection object twice
authorJuergen Gross <jgross@suse.com>
Tue, 12 Sep 2017 12:44:56 +0000 (14:44 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Sep 2017 12:44:56 +0000 (14:44 +0200)
commit562a1c0f7ef3fbf3c122c3dfa4f2ad9dd51da9fe
treed01da96497ba838d7eac14a9339591378ad5b5df
parentc3d830b244998b3686e2eb64db95996be5eb5e5c
tools/xenstore: dont unlink connection object twice

A connection object of a domain with associated stubdom has two
parents: the domain and the stubdom. When cleaning up the list of
active domains in domain_cleanup() make sure not to unlink the
connection twice from the same domain. This could happen when the
domain and its stubdom are being destroyed at the same time leading
to the domain loop being entered twice.

Additionally don't use talloc_free() in this case as it will remove
a random parent link, leading eventually to a memory leak. Use
talloc_unlink() instead specifying the context from which the
connection object should be removed.

This is CVE-2017-14317 / XSA-233.

Reported-by: Eric Chanudet <chanudete@ainfosec.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/xenstore/xenstored_domain.c