diff options
-rw-r--r-- | fs/ext2/dir.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 0b02ba9642d..e89bfc8cf95 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
@@ -368,6 +368,14 @@ struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir, | |||
368 | } | 368 | } |
369 | if (++n >= npages) | 369 | if (++n >= npages) |
370 | n = 0; | 370 | n = 0; |
371 | /* next page is past the blocks we've got */ | ||
372 | if (unlikely(n > (dir->i_blocks >> (PAGE_CACHE_SHIFT - 9)))) { | ||
373 | ext2_error(dir->i_sb, __FUNCTION__, | ||
374 | "dir %lu size %lld exceeds block count %llu", | ||
375 | dir->i_ino, dir->i_size, | ||
376 | (unsigned long long)dir->i_blocks); | ||
377 | goto out; | ||
378 | } | ||
371 | } while (n != start); | 379 | } while (n != start); |
372 | out: | 380 | out: |
373 | return NULL; | 381 | return NULL; |