All of lore.kernel.org
 help / color / mirror / Atom feed
From: leoy@marvell.com (Leo Yan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking
Date: Fri, 29 Jul 2011 10:25:02 +0800	[thread overview]
Message-ID: <4E3219FE.6020306@marvell.com> (raw)
In-Reply-To: <CAMk6uBmE01EpAw3e8kB9v6tEkU0rAPqt8T7+k54QDzDxtDn7PQ@mail.gmail.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 at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>

WARNING: multiple messages have this Message-ID (diff)
From: Leo Yan <leoy@marvell.com>
To: real mz <realmz6@gmail.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"ying.huang@intel.com" <ying.huang@intel.com>
Subject: Re: [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking
Date: Fri, 29 Jul 2011 10:25:02 +0800	[thread overview]
Message-ID: <4E3219FE.6020306@marvell.com> (raw)
In-Reply-To: <CAMk6uBmE01EpAw3e8kB9v6tEkU0rAPqt8T7+k54QDzDxtDn7PQ@mail.gmail.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
>>

  reply	other threads:[~2011-07-29  2:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26  7:19 [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking Leo Yan
2011-07-26  7:19 ` Leo Yan
2011-07-28 10:39 ` real mz
2011-07-28 10:39   ` real mz
2011-07-29  2:25   ` Leo Yan [this message]
2011-07-29  2:25     ` Leo Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E3219FE.6020306@marvell.com \
    --to=leoy@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.