reserve_region_with_split: Fix GFP_KERNEL usage under spinlock
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 1 Nov 2008 16:53:58 +0000 (09:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 1 Nov 2008 16:53:58 +0000 (09:53 -0700)
This one apparently doesn't generate any warnings, because the function
is only used during system bootup, when the warnings are disabled.  But
it's still very wrong.

The __reserve_region_with_split() function is called with the
resource_lock held for writing, so it must only ever do GFP_ATOMIC
allocations.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/resource.c

index 6aac5c60b25d7954f963c40fa15205e7705b02b4..4337063663efe39f8de666d16c591c84f66db0f7 100644 (file)
@@ -523,7 +523,7 @@ static void __init __reserve_region_with_split(struct resource *root,
 {
        struct resource *parent = root;
        struct resource *conflict;
-       struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
+       struct resource *res = kzalloc(sizeof(*res), GFP_ATOMIC);
 
        if (!res)
                return;