Re: [Bug fix PATCH] resource: Reusing a resource structure allocatedby bootmem

From: Yasuaki Ishimatsu
Date: Tue Apr 16 2013 - 20:03:33 EST


Hi Rui,

Thank you for your review.

2013/04/16 17:17, Wang, Rui Y wrote:
-----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) {

You are right. I'll update it.

Thanks,
Yasuaki Ishimatsu

...

Rui



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/