mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] efi: replace GFP_KERNEL with GFP_ATOMIC
@ 2015-10-27 18:42 Saurabh Sengar
  0 siblings, 0 replies; 2+ messages in thread
From: Saurabh Sengar @ 2015-10-27 18:42 UTC (permalink / raw)
  To: matt, linux-efi, linux-kernel; +Cc: Saurabh Sengar

replace GFP_KERNEL with GFP_ATOMIC, as code while holding a spinlock
should be atomic
GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may
fail but certainly avoids deadlock

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
 drivers/firmware/efi/vars.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 70a0fb1..c07de85 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -334,7 +334,7 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,
 	 */
 	efivar_wq_enabled = false;
 
-	str8 = kzalloc(len8, GFP_KERNEL);
+	str8 = kzalloc(len8, GFP_ATOMIC);
 	if (!str8)
 		return;
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] efi: replace GFP_KERNEL with GFP_ATOMIC
  2015-11-03 16:36 [PATCH v2] " Matt Fleming
@ 2015-11-03 17:38 ` Saurabh Sengar
  0 siblings, 0 replies; 2+ messages in thread
From: Saurabh Sengar @ 2015-11-03 17:38 UTC (permalink / raw)
  To: matt, linux-kernel

>It's slightly winding code, but if you look at the callers of
>efivar_init() you'll see that none of them set both 'atomic' and
>'duplicates', so dup_variable_bug() will never be called while holding
>a spinlock.

>Or am I missing something?

I was assuming that there could be a possibility when both 'atomic' and 'duplicates' are set.
If both can never be set, then this patch does not make any sense, you are correct.
Thank you for review

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-03 17:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-27 18:42 [PATCH] efi: replace GFP_KERNEL with GFP_ATOMIC Saurabh Sengar
2015-11-03 16:36 [PATCH v2] " Matt Fleming
2015-11-03 17:38 ` [PATCH] " Saurabh Sengar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome