* [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking
@ 2011-07-26 7:19 Leo Yan
2011-07-28 10:39 ` real mz
0 siblings, 1 reply; 3+ messages in thread
From: Leo Yan @ 2011-07-26 7:19 UTC (permalink / raw)
To: linux-arm-kernel, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel,
Andrew Morton, Leo Yan
The func gen_pool_virt_to_phys will iterate the chunk list;
if find the correct chunk it should need release pool's lock.
Signed-off-by: Leo Yan <leoy@marvell.com>
---
lib/genalloc.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 577ddf8..e625df5 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -92,8 +92,10 @@ phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long addr)
list_for_each(_chunk, &pool->chunks) {
chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
- if (addr >= chunk->start_addr && addr < chunk->end_addr)
+ if (addr >= chunk->start_addr && addr < chunk->end_addr) {
+ read_unlock(&pool->lock);
return chunk->phys_addr + addr - chunk->start_addr;
+ }
}
read_unlock(&pool->lock);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking
2011-07-26 7:19 [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking Leo Yan
@ 2011-07-28 10:39 ` real mz
2011-07-29 2:25 ` Leo Yan
0 siblings, 1 reply; 3+ messages in thread
From: real mz @ 2011-07-28 10:39 UTC (permalink / raw)
To: Leo Yan
Cc: linux-arm-kernel, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel,
Andrew Morton, ying.huang
this fix seems already on next tree
http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=lib/genalloc.c;h=f352cc42f4f8a58b8e4c8304de32cb31b4e29b67;hb=HEAD
On Tue, Jul 26, 2011 at 3:19 PM, Leo Yan <leoy@marvell.com> wrote:
> The func gen_pool_virt_to_phys will iterate the chunk list;
> if find the correct chunk it should need release pool's lock.
>
> Signed-off-by: Leo Yan <leoy@marvell.com>
> ---
> lib/genalloc.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/lib/genalloc.c b/lib/genalloc.c
> index 577ddf8..e625df5 100644
> --- a/lib/genalloc.c
> +++ b/lib/genalloc.c
> @@ -92,8 +92,10 @@ phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long addr)
> list_for_each(_chunk, &pool->chunks) {
> chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
>
> - if (addr >= chunk->start_addr && addr < chunk->end_addr)
> + if (addr >= chunk->start_addr && addr < chunk->end_addr) {
> + read_unlock(&pool->lock);
> return chunk->phys_addr + addr - chunk->start_addr;
> + }
> }
> read_unlock(&pool->lock);
>
> --
> 1.7.4.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking
2011-07-28 10:39 ` real mz
@ 2011-07-29 2:25 ` Leo Yan
0 siblings, 0 replies; 3+ messages in thread
From: Leo Yan @ 2011-07-29 2:25 UTC (permalink / raw)
To: real mz
Cc: linux-arm-kernel@lists.infradead.org,
Jean-Christophe PLAGNIOL-VILLARD, linux-kernel@vger.kernel.org,
Andrew Morton, ying.huang@intel.com
real mz,
You are right. :-) it's long time not see you guy.
For i am developed based on mainline, so if without this
patch, then the kernel will panic.
Best regards,
Leo Yan
On 2011年07月28日 18:39, real mz wrote:
> this fix seems already on next tree
>
> http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=lib/genalloc.c;h=f352cc42f4f8a58b8e4c8304de32cb31b4e29b67;hb=HEAD
>
>
> On Tue, Jul 26, 2011 at 3:19 PM, Leo Yan<leoy@marvell.com> wrote:
>> The func gen_pool_virt_to_phys will iterate the chunk list;
>> if find the correct chunk it should need release pool's lock.
>>
>> Signed-off-by: Leo Yan<leoy@marvell.com>
>> ---
>> lib/genalloc.c | 4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/lib/genalloc.c b/lib/genalloc.c
>> index 577ddf8..e625df5 100644
>> --- a/lib/genalloc.c
>> +++ b/lib/genalloc.c
>> @@ -92,8 +92,10 @@ phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long addr)
>> list_for_each(_chunk,&pool->chunks) {
>> chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
>>
>> - if (addr>= chunk->start_addr&& addr< chunk->end_addr)
>> + if (addr>= chunk->start_addr&& addr< chunk->end_addr) {
>> + read_unlock(&pool->lock);
>> return chunk->phys_addr + addr - chunk->start_addr;
>> + }
>> }
>> read_unlock(&pool->lock);
>>
>> --
>> 1.7.4.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-29 2:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26 7:19 [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking Leo Yan
2011-07-28 10:39 ` real mz
2011-07-29 2:25 ` Leo Yan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox