<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/ext4, branch v3.2.2</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs/ext4?h=v3.2.2</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs/ext4?h=v3.2.2'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-01-26T00:13:07Z</updated>
<entry>
<title>ext4: fix undefined behavior in ext4_fill_flex_info()</title>
<updated>2012-01-26T00:13:07Z</updated>
<author>
<name>Xi Wang</name>
<email>xi.wang@gmail.com</email>
</author>
<published>2012-01-10T16:51:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e2860111eaf589699ff399191dd13b5d3409ef2b'/>
<id>urn:sha1:e2860111eaf589699ff399191dd13b5d3409ef2b</id>
<content type='text'>
commit d50f2ab6f050311dbf7b8f5501b25f0bf64a439b upstream.

Commit 503358ae01b70ce6909d19dd01287093f6b6271c ("ext4: avoid divide by
zero when trying to mount a corrupted file system") fixes CVE-2009-4307
by performing a sanity check on s_log_groups_per_flex, since it can be
set to a bogus value by an attacker.

	sbi-&gt;s_log_groups_per_flex = sbi-&gt;s_es-&gt;s_log_groups_per_flex;
	groups_per_flex = 1 &lt;&lt; sbi-&gt;s_log_groups_per_flex;

	if (groups_per_flex &lt; 2) { ... }

This patch fixes two potential issues in the previous commit.

1) The sanity check might only work on architectures like PowerPC.
On x86, 5 bits are used for the shifting amount.  That means, given a
large s_log_groups_per_flex value like 36, groups_per_flex = 1 &lt;&lt; 36
is essentially 1 &lt;&lt; 4 = 16, rather than 0.  This will bypass the check,
leaving s_log_groups_per_flex and groups_per_flex inconsistent.

2) The sanity check relies on undefined behavior, i.e., oversized shift.
A standard-confirming C compiler could rewrite the check in unexpected
ways.  Consider the following equivalent form, assuming groups_per_flex
is unsigned for simplicity.

	groups_per_flex = 1 &lt;&lt; sbi-&gt;s_log_groups_per_flex;
	if (groups_per_flex == 0 || groups_per_flex == 1) {

We compile the code snippet using Clang 3.0 and GCC 4.6.  Clang will
completely optimize away the check groups_per_flex == 0, leaving the
patched code as vulnerable as the original.  GCC keeps the check, but
there is no guarantee that future versions will do the same.

Signed-off-by: Xi Wang &lt;xi.wang@gmail.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>ext4: add missing ext4_resize_end on error paths</title>
<updated>2012-01-26T00:13:07Z</updated>
<author>
<name>Djalal Harouni</name>
<email>tixxdz@opendz.org</email>
</author>
<published>2012-01-04T22:09:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=19800ba5243e10668bbed7eef85ddd16452e5d26'/>
<id>urn:sha1:19800ba5243e10668bbed7eef85ddd16452e5d26</id>
<content type='text'>
commit 014a1770371a028d22f364718c805f4216911ecd upstream.

Online resize ioctls 'EXT4_IOC_GROUP_EXTEND' and 'EXT4_IOC_GROUP_ADD'
call ext4_resize_begin() to check permissions and to set the
EXT4_RESIZING bit lock, they do their work and they must finish with
ext4_resize_end() which calls clear_bit_unlock() to unlock and to
avoid -EBUSY errors for the next resize operations.

This patch adds the missing ext4_resize_end() calls on error paths.

Patch tested.

Signed-off-by: Djalal Harouni &lt;tixxdz@opendz.org&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>ext4: handle EOF correctly in ext4_bio_write_page()</title>
<updated>2011-12-14T03:29:12Z</updated>
<author>
<name>Yongqiang Yang</name>
<email>xiaoqiangnk@gmail.com</email>
</author>
<published>2011-12-14T03:29:12Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5a0dc7365c240795bf190766eba7a27600be3b3e'/>
<id>urn:sha1:5a0dc7365c240795bf190766eba7a27600be3b3e</id>
<content type='text'>
We need to zero out part of a page which beyond EOF before setting uptodate,
otherwise, mapread or write will see non-zero data beyond EOF.

Signed-off-by: Yongqiang Yang &lt;xiaoqiangnk@gmail.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>ext4: remove a wrong BUG_ON in ext4_ext_convert_to_initialized</title>
<updated>2011-12-14T03:13:42Z</updated>
<author>
<name>Yongqiang Yang</name>
<email>xiaoqiangnk@gmail.com</email>
</author>
<published>2011-12-14T03:13:42Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5b5ffa49d4bbb8ca4c41c094261660264f16bd20'/>
<id>urn:sha1:5b5ffa49d4bbb8ca4c41c094261660264f16bd20</id>
<content type='text'>
If a file is fallocated on a hole, map-&gt;m_lblk + map-&gt;m_len may be greater
than ee_block + ee_len.

Signed-off-by: Yongqiang Yang &lt;xiaoqiangnk@gmail.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>ext4: correctly handle pages w/o buffers in ext4_discard_partial_buffers()</title>
<updated>2011-12-14T03:05:05Z</updated>
<author>
<name>Yongqiang Yang</name>
<email>xiaoqiangnk@gmail.com</email>
</author>
<published>2011-12-14T03:05:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=093e6e3666f47d29763a235b404c84ee47ba8bb0'/>
<id>urn:sha1:093e6e3666f47d29763a235b404c84ee47ba8bb0</id>
<content type='text'>
If a page has been read into memory and never been written, it has no
buffers, but we should handle the page in truncate or punch hole.

VFS code of writing operations has handled holes correctly, so this
patch removes the code handling holes in writing operations.

Signed-off-by: Yongqiang Yang &lt;xiaoqiangnk@gmail.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>ext4: avoid potential hang in mpage_submit_io() when blocksize &lt; pagesize</title>
<updated>2011-12-14T02:51:55Z</updated>
<author>
<name>Yongqiang Yang</name>
<email>xiaoqiangnk@gmail.com</email>
</author>
<published>2011-12-14T02:51:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=13a79a4741d37fda2fbafb953f0f301dc007928f'/>
<id>urn:sha1:13a79a4741d37fda2fbafb953f0f301dc007928f</id>
<content type='text'>
If there is an unwritten but clean buffer in a page and there is a
dirty buffer after the buffer, then mpage_submit_io does not write the
dirty buffer out.  As a result, da_writepages loops forever.

This patch fixes the problem by checking dirty flag.

Signed-off-by: Yongqiang Yang &lt;xiaoqiangnk@gmail.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>ext4: avoid hangs in ext4_da_should_update_i_disksize()</title>
<updated>2011-12-14T02:41:15Z</updated>
<author>
<name>Andrea Arcangeli</name>
<email>aarcange@redhat.com</email>
</author>
<published>2011-12-14T02:41:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ea51d132dbf9b00063169c1159bee253d9649224'/>
<id>urn:sha1:ea51d132dbf9b00063169c1159bee253d9649224</id>
<content type='text'>
If the pte mapping in generic_perform_write() is unmapped between
iov_iter_fault_in_readable() and iov_iter_copy_from_user_atomic(), the
"copied" parameter to -&gt;end_write can be zero. ext4 couldn't cope with
it with delayed allocations enabled. This skips the i_disksize
enlargement logic if copied is zero and no new data was appeneded to
the inode.

 gdb&gt; bt
 #0  0xffffffff811afe80 in ext4_da_should_update_i_disksize (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x1\
 08000, len=0x1000, copied=0x0, page=0xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2467
 #1  ext4_da_write_end (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x108000, len=0x1000, copied=0x0, page=0\
 xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2512
 #2  0xffffffff810d97f1 in generic_perform_write (iocb=&lt;value optimized out&gt;, iov=&lt;value optimized out&gt;, nr_segs=&lt;value o\
 ptimized out&gt;, pos=0x108000, ppos=0xffff88001e26be40, count=&lt;value optimized out&gt;, written=0x0) at mm/filemap.c:2440
 #3  generic_file_buffered_write (iocb=&lt;value optimized out&gt;, iov=&lt;value optimized out&gt;, nr_segs=&lt;value optimized out&gt;, p\
 os=0x108000, ppos=0xffff88001e26be40, count=&lt;value optimized out&gt;, written=0x0) at mm/filemap.c:2482
 #4  0xffffffff810db5d1 in __generic_file_aio_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=0x1, ppos=0\
 xffff88001e26be40) at mm/filemap.c:2600
 #5  0xffffffff810db853 in generic_file_aio_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=&lt;value optimi\
 zed out&gt;, pos=&lt;value optimized out&gt;) at mm/filemap.c:2632
 #6  0xffffffff811a71aa in ext4_file_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=0x1, pos=0x108000) a\
 t fs/ext4/file.c:136
 #7  0xffffffff811375aa in do_sync_write (filp=0xffff88003f606a80, buf=&lt;value optimized out&gt;, len=&lt;value optimized out&gt;, \
 ppos=0xffff88001e26bf48) at fs/read_write.c:406
 #8  0xffffffff81137e56 in vfs_write (file=0xffff88003f606a80, buf=0x1ec2960 &lt;Address 0x1ec2960 out of bounds&gt;, count=0x4\
 000, pos=0xffff88001e26bf48) at fs/read_write.c:435
 #9  0xffffffff8113816c in sys_write (fd=&lt;value optimized out&gt;, buf=0x1ec2960 &lt;Address 0x1ec2960 out of bounds&gt;, count=0x\
 4000) at fs/read_write.c:487
 #10 &lt;signal handler called&gt;
 #11 0x00007f120077a390 in __brk_reservation_fn_dmi_alloc__ ()
 #12 0x0000000000000000 in ?? ()
 gdb&gt; print offset
 $22 = 0xffffffffffffffff
 gdb&gt; print idx
 $23 = 0xffffffff
 gdb&gt; print inode-&gt;i_blkbits
 $24 = 0xc
 gdb&gt; up
 #1  ext4_da_write_end (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x108000, len=0x1000, copied=0x0, page=0\
 xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2512
 2512                    if (ext4_da_should_update_i_disksize(page, end)) {
 gdb&gt; print start
 $25 = 0x0
 gdb&gt; print end
 $26 = 0xffffffffffffffff
 gdb&gt; print pos
 $27 = 0x108000
 gdb&gt; print new_i_size
 $28 = 0x108000
 gdb&gt; print ((struct ext4_inode_info *)((char *)inode-((int)(&amp;((struct ext4_inode_info *)0)-&gt;vfs_inode))))-&gt;i_disksize
 $29 = 0xd9000
 gdb&gt; down
 2467            for (i = 0; i &lt; idx; i++)
 gdb&gt; print i
 $30 = 0xd44acbee

This is 100% reproducible with some autonuma development code tuned in
a very aggressive manner (not normal way even for knumad) which does
"exotic" changes to the ptes. It wouldn't normally trigger but I don't
see why it can't happen normally if the page is added to swap cache in
between the two faults leading to "copied" being zero (which then
hangs in ext4). So it should be fixed. Especially possible with lumpy
reclaim (albeit disabled if compaction is enabled) as that would
ignore the young bits in the ptes.

Signed-off-by: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>ext4: display the correct mount option in /proc/mounts for [no]init_itable</title>
<updated>2011-12-13T03:06:18Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2011-12-13T03:06:18Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fc6cb1cda5db7b2d24bf32890826214b857c728e'/>
<id>urn:sha1:fc6cb1cda5db7b2d24bf32890826214b857c728e</id>
<content type='text'>
/proc/mounts was showing the mount option [no]init_inode_table when
the correct mount option that will be accepted by parse_options() is
[no]init_itable.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>ext4: Fix crash due to getting bogus eh_depth value on big-endian systems</title>
<updated>2011-12-12T16:00:56Z</updated>
<author>
<name>Paul Mackerras</name>
<email>paulus@samba.org</email>
</author>
<published>2011-12-12T16:00:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b4611abfa98af8351bf32e8b9ecc9d3384931c37'/>
<id>urn:sha1:b4611abfa98af8351bf32e8b9ecc9d3384931c37</id>
<content type='text'>
Commit 1939dd84b3 ("ext4: cleanup ext4_ext_grow_indepth code") added a
reference to ext4_extent_header.eh_depth, but forget to pass the value
read through le16_to_cpu.  The result is a crash on big-endian
machines, such as this crash on a POWER7 server:

attempt to access beyond end of device
sda8: rw=0, want=776392648163376, limit=168558560
Unable to handle kernel paging request for data at address 0x6b6b6b6b6b6b6bcb
Faulting instruction address: 0xc0000000001f5f38
cpu 0x14: Vector: 300 (Data Access) at [c000001bd1aaecf0]
    pc: c0000000001f5f38: .__brelse+0x18/0x60
    lr: c0000000002e07a4: .ext4_ext_drop_refs+0x44/0x80
    sp: c000001bd1aaef70
   msr: 9000000000009032
   dar: 6b6b6b6b6b6b6bcb
 dsisr: 40000000
  current = 0xc000001bd15b8010
  paca    = 0xc00000000ffe4600
    pid   = 19911, comm = flush-8:0
enter ? for help
[c000001bd1aaeff0] c0000000002e07a4 .ext4_ext_drop_refs+0x44/0x80
[c000001bd1aaf090] c0000000002e0c58 .ext4_ext_find_extent+0x408/0x4c0
[c000001bd1aaf180] c0000000002e145c .ext4_ext_insert_extent+0x2bc/0x14c0
[c000001bd1aaf2c0] c0000000002e3fb8 .ext4_ext_map_blocks+0x628/0x1710
[c000001bd1aaf420] c0000000002b2974 .ext4_map_blocks+0x224/0x310
[c000001bd1aaf4d0] c0000000002b7f2c .mpage_da_map_and_submit+0xbc/0x490
[c000001bd1aaf5a0] c0000000002b8688 .write_cache_pages_da+0x2c8/0x430
[c000001bd1aaf720] c0000000002b8b28 .ext4_da_writepages+0x338/0x670
[c000001bd1aaf8d0] c000000000157280 .do_writepages+0x40/0x90
[c000001bd1aaf940] c0000000001ea830 .writeback_single_inode+0xe0/0x530
[c000001bd1aafa00] c0000000001eb680 .writeback_sb_inodes+0x210/0x300
[c000001bd1aafb20] c0000000001ebc84 .__writeback_inodes_wb+0xd4/0x140
[c000001bd1aafbe0] c0000000001ebfec .wb_writeback+0x2fc/0x3e0
[c000001bd1aafce0] c0000000001ed770 .wb_do_writeback+0x2f0/0x300
[c000001bd1aafdf0] c0000000001ed848 .bdi_writeback_thread+0xc8/0x340
[c000001bd1aafed0] c0000000000c5494 .kthread+0xb4/0xc0
[c000001bd1aaff90] c000000000021f48 .kernel_thread+0x54/0x70

This is due to getting ext_depth(inode) == 0x101 and therefore running
off the end of the path array in ext4_ext_drop_refs into following
unallocated structures.

This fixes it by adding the necessary le16_to_cpu.

Signed-off-by: Paul Mackerras &lt;paulus@samba.org&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: fix ext4_end_io_dio() racing against fsync()</title>
<updated>2011-12-12T15:53:02Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2011-12-12T15:53:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b5a7e97039a80fae673ccc115ce595d5b88fb4ee'/>
<id>urn:sha1:b5a7e97039a80fae673ccc115ce595d5b88fb4ee</id>
<content type='text'>
We need to make sure iocb-&gt;private is cleared *before* we put the
io_end structure on i_completed_io_list.  Otherwise fsync() could
potentially run on another CPU and free the iocb structure out from
under us.

Reported-by: Kent Overstreet &lt;koverstreet@google.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Cc: stable@kernel.org
</content>
</entry>
</feed>
