diff options
author | Nikanth Karthikesan <knikanth@suse.de> | 2009-04-02 19:56:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-02 22:04:49 -0400 |
commit | 97f76d3d197f201ac8a8a3ced5b8fef81568e50e (patch) | |
tree | 8264f920a1f1a83e9cb0247ffe9390a7b6332852 /fs/buffer.c | |
parent | 9a896c9a48ac6704c0ce8ee081b836644d0afe40 (diff) |
vfs: check bh->b_blocknr only if BH_Mapped is set
Check bh->b_blocknr only if BH_Mapped is set.
akpm: I doubt if b_blocknr is ever uninitialised here, but it could
conceivably cause a problem if we're doing a lookup for block zero.
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index f5f8b15a6e40..2963858f0f31 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -199,13 +199,13 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) | |||
199 | head = page_buffers(page); | 199 | head = page_buffers(page); |
200 | bh = head; | 200 | bh = head; |
201 | do { | 201 | do { |
202 | if (bh->b_blocknr == block) { | 202 | if (!buffer_mapped(bh)) |
203 | all_mapped = 0; | ||
204 | else if (bh->b_blocknr == block) { | ||
203 | ret = bh; | 205 | ret = bh; |
204 | get_bh(bh); | 206 | get_bh(bh); |
205 | goto out_unlock; | 207 | goto out_unlock; |
206 | } | 208 | } |
207 | if (!buffer_mapped(bh)) | ||
208 | all_mapped = 0; | ||
209 | bh = bh->b_this_page; | 209 | bh = bh->b_this_page; |
210 | } while (bh != head); | 210 | } while (bh != head); |
211 | 211 | ||