Skip to content

Commit

Permalink
vfs: check bh->b_blocknr only if BH_Mapped is set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nikanth Karthikesan authored and Linus Torvalds committed Apr 3, 2009
1 parent 9a896c9 commit 97f76d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
head = page_buffers(page);
bh = head;
do {
if (bh->b_blocknr == block) {
if (!buffer_mapped(bh))
all_mapped = 0;
else if (bh->b_blocknr == block) {
ret = bh;
get_bh(bh);
goto out_unlock;
}
if (!buffer_mapped(bh))
all_mapped = 0;
bh = bh->b_this_page;
} while (bh != head);

Expand Down

0 comments on commit 97f76d3

Please sign in to comment.