Skip to contentSkip to conversation

test_meminit: use GFP_ATOMIC in RCU critical section

PATCH New Alexander Potapenko 1 participant 1 message Jul 25, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test_meminit: use GFP_ATOMIC in RCU critical section

kmalloc() shouldn't sleep while in RCU critical section, therefore use GFP_ATOMIC instead of GFP_KERNEL.

The bug has been spotted by the 0day kernel testing robot.

Fixes 7e659650cbda ("lib: introduce test_meminit module")
Cc Kees Cook <[email protected]>
Cc Andrew Morton <[email protected]>
---
 lib/test_meminit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_meminit.c +1 -1
index 62d19f270cad..9729f271d150 100644
@@ -222,7 +222,7 @@ static int __init do_kmem_cache_size(size_t size, bool want_ctor,
 		 * Copy the buffer to check that it's not wiped on
 		 * free().
 		 */
-		buf_copy = kmalloc(size, GFP_KERNEL);
+		buf_copy = kmalloc(size, GFP_ATOMIC);
 		if (buf_copy)
 			memcpy(buf_copy, buf, size);
 
Signature · 1 line
2.22.0.657.g960e92d24f-goog