/[linux-patches]/genpatches-2.6/tags/2.6.18-9/1920_ext2-corrupt-dir-size.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.18-9/1920_ext2-corrupt-dir-size.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 802 - (show annotations) (download)
Wed Jan 10 14:47:23 2007 UTC (11 years ago) by dsd
File size: 1766 byte(s)
2.6.18-9 release
1 From: Eric Sandeen <sandeen@redhat.com>
2 User-Agent: Thunderbird 1.5.0.8 (X11/20061107)
3 MIME-Version: 1.0
4 To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
5 ext4 development <linux-ext4@vger.kernel.org>
6 Subject: [PATCH] ext2: skip pages past number of blocks in ext2_find_entry
7 Content-Type: text/plain; charset=ISO-8859-1
8 Content-Transfer-Encoding: 7bit
9 Sender: linux-kernel-owner@vger.kernel.org
10 Precedence: bulk
11 X-Mailing-List: linux-kernel@vger.kernel.org
12 X-Virus-Scan: scanned
13
14 This one was pointed out on the MOKB site:
15 http://kernelfun.blogspot.com/2006/11/mokb-09-11-2006-linux-26x-ext2checkpage.html
16
17 If a directory's i_size is corrupted, ext2_find_entry() will keep processing
18 pages until the i_size is reached, even if there are no more blocks associated
19 with the directory inode. This patch puts in some minimal sanity-checking
20 so that we don't keep checking pages (and issuing errors) if we know there
21 can be no more data to read, based on the block count of the directory inode.
22
23 This is somewhat similar in approach to the ext3 patch I sent earlier this
24 year.
25
26 Thanks,
27
28 -Eric
29
30 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
31
32 Index: linux-2.6.19/fs/ext2/dir.c
33 ===================================================================
34 --- linux-2.6.19.orig/fs/ext2/dir.c
35 +++ linux-2.6.19/fs/ext2/dir.c
36 @@ -368,6 +368,14 @@ struct ext2_dir_entry_2 * ext2_find_entr
37 }
38 if (++n >= npages)
39 n = 0;
40 + /* next page is past the blocks we've got */
41 + if (unlikely(n > (dir->i_blocks >> (PAGE_CACHE_SHIFT - 9)))) {
42 + ext2_error(dir->i_sb, __FUNCTION__,
43 + "dir %lu size %lld exceeds block count %llu",
44 + dir->i_ino, dir->i_size,
45 + (unsigned long long)dir->i_blocks);
46 + goto out;
47 + }
48 } while (n != start);
49 out:
50 return NULL;
51
52

  ViewVC Help
Powered by ViewVC 1.1.20