-----Original Message-----
From: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>
Date: Mon, 15 Apr 2013 11:15:28 +0900
Subject: [Bug fix PATCH] resource: Reusing a resource structure allocated by
bootmem
To: akpm@xxxxxxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx, rientjes@xxxxxxxxxx, linuxram@xxxxxxxxxx,
toshi.kani@xxxxxx, Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>
<<...>>
+ if (bootmem_resource.sibling) {
+ spin_lock(&bootmem_resource_lock);
+ res = bootmem_resource.sibling;
+ bootmem_resource.sibling = res->sibling;
+ spin_unlock(&bootmem_resource_lock);
+ memset(res, 0, sizeof(struct resource));
+ } else {
+ res = kzalloc(sizeof(struct resource), flags);
+ }
bootmem_resource_lock does not protect the if() statement from accessing bootmem_resource.sibling.
spin_lock(&bootmem_resource_lock);
if (bootmem_resource.sibling) {
...
Rui