]> xenbits.xensource.com Git - xen.git/commitdiff
kexec: clear kexec_image slot when unloading kexec image
authorBhavesh Davda <bhavesh.davda@oracle.com>
Wed, 3 May 2017 15:03:34 +0000 (17:03 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 3 May 2017 15:03:34 +0000 (17:03 +0200)
When kexec_do_unload calls kexec_swap_images to get the old kexec_image to
free, it passes NULL for the new kexec_image pointer. The new slot wasn't being
cleared in such a case, leading to a stale pointer being left behind in the
kexec_image array and Xen panics in subsequent load/unload operations.

Signed-off-by: Bhavesh Davda <bhavesh.davda@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 5c5216e825332c83b1965b5a39a6100f9dde34da
master date: 2017-04-04 11:34:57 +0200

xen/common/kexec.c

index c83d48fc79db6745bbf99ffafcbef4536f1be46c..33071bcb862695bb0a537279a3c46c980dc57701 100644 (file)
@@ -837,11 +837,9 @@ static int kexec_swap_images(int type, struct kexec_image *new,
     old_slot = base + pos;
     new_slot = base + !pos;
 
+    kexec_image[new_slot] = new;
     if ( new )
-    {
-        kexec_image[new_slot] = new;
         set_bit(new_slot, &kexec_flags);
-    }
     change_bit(bit, &kexec_flags);
 
     clear_bit(old_slot, &kexec_flags);