tools/xenstore: fix event sending in introduce_domain()
authorJuergen Gross <jgross@suse.com>
Wed, 25 May 2022 10:55:49 +0000 (12:55 +0200)
committerJulien Grall <jgrall@amazon.com>
Wed, 25 May 2022 11:10:03 +0000 (12:10 +0100)
Commit fc2b57c9af46 ("xenstored: send an evtchn notification on
introduce_domain") introduced a potential NULL dereference in case of
Xenstore live update.

Fix that by adding an appropriate check.

Coverity-Id: 1504572
Fixes: fc2b57c9af46 ("xenstored: send an evtchn notification on introduce_domain")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/xenstore/xenstored_domain.c

index de88bf2a68421668dc53a0950644e0df572a13ba..ead4c237d233edfe6b9c105b214490c958722b2b 100644 (file)
@@ -493,9 +493,11 @@ static struct domain *introduce_domain(const void *ctx,
                /* Now domain belongs to its connection. */
                talloc_steal(domain->conn, domain);
 
-               /* Notify the domain that xenstore is available */
-               interface->connection = XENSTORE_CONNECTED;
-               xenevtchn_notify(xce_handle, domain->port);
+               if (!restore) {
+                       /* Notify the domain that xenstore is available */
+                       interface->connection = XENSTORE_CONNECTED;
+                       xenevtchn_notify(xce_handle, domain->port);
+               }
 
                if (!is_master_domain && !restore)
                        fire_watches(NULL, ctx, "@introduceDomain", NULL,