[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/5] vm/vm_fault.c: check if active_threads is NULL
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 4/5] vm/vm_fault.c: check if active_threads is NULL |
Date: |
Tue, 19 Nov 2013 20:51:41 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Marin Ramesa, le Tue 19 Nov 2013 07:34:22 +0100, a écrit :
> Check is active_threads is NULL before calling current_task() to
> avoid dereference of null pointer.
Ah, the vm_stat_sample tracing macro is extra careful about
current_thread(), probably because it may be called very early during
boot, but current_thread() really is always non-NULL when vm_fault_page
is called.
> * vm/vm_fault.c (active_threads): Check if it's NULL.
>
> ---
> vm/vm_fault.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/vm/vm_fault.c b/vm/vm_fault.c
> index 4b30f98..1089491 100644
> --- a/vm/vm_fault.c
> +++ b/vm/vm_fault.c
> @@ -249,7 +249,8 @@ vm_fault_return_t vm_fault_page(first_object,
> first_offset,
>
> vm_stat_sample(SAMPLED_PC_VM_FAULTS_ANY);
> vm_stat.faults++; /* needs lock XXX */
> - current_task()->faults++;
> + if (active_threads[(0)] != NULL)
> + current_task()->faults++;
>
> /*
> * Recovery actions
> --
> 1.8.1.4
>
>
--
Samuel
"...Deep Hack Mode--that mysterious and frightening state of
consciousness where Mortal Users fear to tread."
(By Matt Welsh)
- Re: [PATCH 1/5] kern/slab.c: initialize optimal_embed, (continued)
[PATCH 2/5] kern/slab.c: initialize info_size, Marin Ramesa, 2013/11/19
[PATCH 3/5] kern/processor.c: check if threads is NULL, Marin Ramesa, 2013/11/19
[PATCH 5/5] vm/vm_fault.c: check if active_threads is NULL, Marin Ramesa, 2013/11/19
[PATCH 4/5] vm/vm_fault.c: check if active_threads is NULL, Marin Ramesa, 2013/11/19
- Re: [PATCH 4/5] vm/vm_fault.c: check if active_threads is NULL,
Samuel Thibault <=