From: Leo Yan <leoy@marvell.com>
To: linux-arm-kernel@lists.infradead.org,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Leo Yan <leoy@marvell.com>
Subject: [PATCH] lib/genalloc: fix gen_pool_virt_to_phys locking
Date: Tue, 26 Jul 2011 15:19:01 +0800 [thread overview]
Message-ID: <1311664741-21336-1-git-send-email-leoy@marvell.com> (raw)
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
next reply other threads:[~2011-07-26 7:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 7:19 Leo Yan [this message]
2011-07-28 10:39 ` real mz
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=1311664741-21336-1-git-send-email-leoy@marvell.com \
--to=leoy@marvell.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®