From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Date: Mon, 10 Mar 2014 16:47:46 +0000 Subject: Re: [patch] x86/efi: use GFP_ATOMIC under spin_lock Message-Id: <531DECB2.3020405@zytor.com> List-Id: References: <20140307112055.GE2351@elgon.mountain> In-Reply-To: <20140307112055.GE2351@elgon.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter , Matt Fleming , Nathan Zimmer Cc: Thomas Gleixner , Ingo Molnar , x86@kernel.org, linux-efi@vger.kernel.org, kernel-janitors@vger.kernel.org On 03/07/2014 03:20 AM, Dan Carpenter wrote: > In phys_efi_get_time() we call efi_call_phys_prelog() with a spin_lock > so this allocation should be atomic. > > Fixes: b8f2c21db390 ('efi, x86: Pass a proper identity mapping in efi_call_phys_prelog') > Signed-off-by: Dan Carpenter > > diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c > index 0c2a234fef1e..f5adcadb381b 100644 > --- a/arch/x86/platform/efi/efi_64.c > +++ b/arch/x86/platform/efi/efi_64.c > @@ -90,7 +90,7 @@ void __init efi_call_phys_prelog(void) > local_irq_save(efi_flags); > > n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); > - save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL); > + save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_ATOMIC); > > for (pgd = 0; pgd < n_pgds; pgd++) { > save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE); > And what happens if the allocation fails, as GFP_ATOMIC allocations are wont to do? I see an inbound NULL pointer reference from miles away here... -hpa