Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281524 > unrolled thread

[PATCH v2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()

Started byXunlei Pang <xlpang@redhat.com>
First post2015-12-02 09:50 +0100
Last post2015-12-11 04:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list() Xunlei Pang <xlpang@redhat.com> - 2015-12-02 09:50 +0100
    Re: [PATCH v2] kexec: Set KEXEC_TYPE_CRASH before  sanity_check_segment_list() Baoquan He <bhe@redhat.com> - 2015-12-11 04:00 +0100

#1281524 — [PATCH v2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()

FromXunlei Pang <xlpang@redhat.com>
Date2015-12-02 09:50 +0100
Subject[PATCH v2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()
Message-ID<qBbgR-4Mq-1@gated-at.bofh.it>
sanity_check_segment_list() checks KEXEC_TYPE_CRASH flag to ensure
all the segments of the loaded crash kernel are winthin the kernel
crash resource limits, so set the flag beforehand.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
---
v1 -> v2:
Improved some comments.

 kernel/kexec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/kexec.c b/kernel/kexec.c
index d873b64..ee70aef 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -63,16 +63,16 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,
 	if (ret)
 		goto out_free_image;
 
-	ret = sanity_check_segment_list(image);
-	if (ret)
-		goto out_free_image;
-
-	 /* Enable the special crash kernel control page allocation policy. */
 	if (kexec_on_panic) {
+		/* Enable special crash kernel control page alloc policy. */
 		image->control_page = crashk_res.start;
 		image->type = KEXEC_TYPE_CRASH;
 	}
 
+	ret = sanity_check_segment_list(image);
+	if (ret)
+		goto out_free_image;
+
 	/*
 	 * Find a location for the control code buffer, and add it
 	 * the vector of segments so that it's pages will also be
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1289075 — Re: [PATCH v2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()

FromBaoquan He <bhe@redhat.com>
Date2015-12-11 04:00 +0100
SubjectRe: [PATCH v2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()
Message-ID<qEm65-6uo-9@gated-at.bofh.it>
In reply to#1281524
On 12/02/15 at 04:39pm, Xunlei Pang wrote:
> sanity_check_segment_list() checks KEXEC_TYPE_CRASH flag to ensure
> all the segments of the loaded crash kernel are winthin the kernel
> crash resource limits, so set the flag beforehand.
> 
> Signed-off-by: Xunlei Pang <xlpang@redhat.com>
> Acked-by: Dave Young <dyoung@redhat.com>
> ---
> v1 -> v2:
> Improved some comments.
> 
>  kernel/kexec.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/kexec.c b/kernel/kexec.c
> index d873b64..ee70aef 100644
> --- a/kernel/kexec.c
> +++ b/kernel/kexec.c
> @@ -63,16 +63,16 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,
>  	if (ret)
>  		goto out_free_image;
>  
> -	ret = sanity_check_segment_list(image);
> -	if (ret)
> -		goto out_free_image;
> -
> -	 /* Enable the special crash kernel control page allocation policy. */
>  	if (kexec_on_panic) {
> +		/* Enable special crash kernel control page alloc policy. */
>  		image->control_page = crashk_res.start;
>  		image->type = KEXEC_TYPE_CRASH;
>  	}

Good catch. This is hard to be found because kexec-tools user space
utility has make sure it's well located. It must be a code reviewing
finding. Ack it.

Acked-by: Baoquan He <bhe@redhat.com>

Thanks
Baoquan

>  
> +	ret = sanity_check_segment_list(image);
> +	if (ret)
> +		goto out_free_image;
> +
>  	/*
>  	 * Find a location for the control code buffer, and add it
>  	 * the vector of segments so that it's pages will also be
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web