x86: adjust place of an ASSERT to avoid crash when destroy a domain.
authorYi Sun <yi.y.sun@linux.intel.com>
Mon, 7 Aug 2017 01:50:49 +0000 (09:50 +0800)
committerWei Liu <wei.liu2@citrix.com>
Mon, 7 Aug 2017 10:46:59 +0000 (11:46 +0100)
In 'psr_free_cos', we should not use 'ASSERT(socket_info)' at the beginning
because the 'socket_info' is allocated only if 'psr' boot parameter is set.
So adjust its place to avoid crash.

Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/psr.c

index 7d9fa265f31ddb8e2c2f13b66c74c1a1e4e5d860..9ce8f17a181b459f2a04289c17c188509d457de9 100644 (file)
@@ -1294,11 +1294,11 @@ static void psr_free_cos(struct domain *d)
 {
     unsigned int socket, cos;
 
-    ASSERT(socket_info);
-
     if ( !d->arch.psr_cos_ids )
         return;
 
+    ASSERT(socket_info);
+
     /* Domain is destroyed so its cos_ref should be decreased. */
     for ( socket = 0; socket < nr_sockets; socket++ )
     {