diff mbox

x86: remove an ASSERT to avoid crash when destroy a domain.

Message ID 1501896398-69885-1-git-send-email-yi.y.sun@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yi Sun Aug. 5, 2017, 1:26 a.m. UTC
In 'psr_free_cos', we should not use 'ASSERT(socket_info)' because
the 'socket_info' is allocated only if 'psr' boot parameter is set.
So remove it and use 'psr_alloc_feat_enabled' to check if 'socket_info'
is valid or not to avoid crash.

Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
---
 xen/arch/x86/psr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Beulich Aug. 6, 2017, 9:34 a.m. UTC | #1
>>> Yi Sun <yi.y.sun@linux.intel.com> 08/05/17 3:42 AM >>>
>In 'psr_free_cos', we should not use 'ASSERT(socket_info)' because
>the 'socket_info' is allocated only if 'psr' boot parameter is set.
>So remove it and use 'psr_alloc_feat_enabled' to check if 'socket_info'
>is valid or not to avoid crash.

Title and description are no longer in line with the actual change.

Jan
Yi Sun Aug. 7, 2017, 1:21 a.m. UTC | #2
On 17-08-06 03:34:20, Jan Beulich wrote:
> >>> Yi Sun <yi.y.sun@linux.intel.com> 08/05/17 3:42 AM >>>
> >In 'psr_free_cos', we should not use 'ASSERT(socket_info)' because
> >the 'socket_info' is allocated only if 'psr' boot parameter is set.
> >So remove it and use 'psr_alloc_feat_enabled' to check if 'socket_info'
> >is valid or not to avoid crash.
> 
> Title and description are no longer in line with the actual change.
> 
Oh, sorry, my fault, too hurried to change these.

> Jan
diff mbox

Patch

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 7d9fa26..9ce8f17 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -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++ )
     {