Commit 97f76d3d authored by Nikanth Karthikesan's avatar Nikanth Karthikesan Committed by Linus Torvalds

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: default avatarNikanth Karthikesan <knikanth@suse.de>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9a896c9a
...@@ -199,13 +199,13 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) ...@@ -199,13 +199,13 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
head = page_buffers(page); head = page_buffers(page);
bh = head; bh = head;
do { do {
if (bh->b_blocknr == block) { if (!buffer_mapped(bh))
all_mapped = 0;
else if (bh->b_blocknr == block) {
ret = bh; ret = bh;
get_bh(bh); get_bh(bh);
goto out_unlock; goto out_unlock;
} }
if (!buffer_mapped(bh))
all_mapped = 0;
bh = bh->b_this_page; bh = bh->b_this_page;
} while (bh != head); } while (bh != head);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment