Chandan Rajendra
9d5afec6b8
ext4: fix crash when a directory's i_size is too small
...
On a ppc64 machine, when mounting a fuzzed ext2 image (generated by
fsfuzzer) the following call trace is seen,
VFS: brelse: Trying to free free buffer
WARNING: CPU: 1 PID: 6913 at /root/repos/linux/fs/buffer.c:1165 .__brelse.part.6+0x24/0x40
.__brelse.part.6+0x20/0x40 (unreliable)
.ext4_find_entry+0x384/0x4f0
.ext4_lookup+0x84/0x250
.lookup_slow+0xdc/0x230
.walk_component+0x268/0x400
.path_lookupat+0xec/0x2d0
.filename_lookup+0x9c/0x1d0
.vfs_statx+0x98/0x140
.SyS_newfstatat+0x48/0x80
system_call+0x58/0x6c
This happens because the directory that ext4_find_entry() looks up has
inode->i_size that is less than the block size of the filesystem. This
causes 'nblocks' to have a value of zero. ext4_bread_batch() ends up not
reading any of the directory file's blocks. This renders the entries in
bh_use[] array to continue to have garbage data. buffer_uptodate() on
bh_use[0] can then return a zero value upon which brelse() function is
invoked.
This commit fixes the bug by returning -ENOENT when the directory file
has no associated blocks.
Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
2017-12-11 15:00:57 -05:00
..
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-12-01 11:51:24 +00:00
2017-11-29 18:40:43 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-29 14:26:50 -08:00
2017-11-15 18:21:06 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-10-19 16:15:16 +02:00
2017-11-27 13:05:09 -08:00
2017-11-14 11:35:15 -08:00
2017-11-07 20:25:03 +01:00
2017-08-24 13:23:03 -07:00
2017-11-14 14:44:04 -08:00
2017-11-27 13:05:09 -08:00
2017-07-11 06:09:21 -04:00
2017-11-27 13:05:09 -08:00
2017-09-07 11:59:42 -07:00
2017-11-27 13:05:09 -08:00
2017-12-11 15:00:57 -05:00
2017-11-27 13:05:09 -08:00
2017-11-29 18:40:43 -08:00
2017-11-27 13:05:09 -08:00
2017-11-16 11:41:22 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-27 13:05:09 -08:00
2017-11-29 18:40:43 -08:00
2017-11-27 13:05:09 -08:00
2017-11-17 09:51:57 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 16:45:11 -05:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-12-01 20:04:20 -05:00
2017-11-27 16:45:11 -05:00
2017-11-27 16:45:11 -05:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 16:45:56 -08:00
2017-11-21 15:57:05 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-29 16:46:48 +01:00
2017-09-06 17:27:26 -07:00
2017-11-30 18:38:47 -05:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-07-06 03:31:46 -04:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-12-01 20:00:19 -05:00
2017-11-17 11:54:55 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-04 19:05:15 -04:00
2017-11-17 12:54:01 -08:00
2017-11-16 12:50:35 -08:00
2017-11-02 11:10:55 +01:00
2017-10-13 16:18:33 -07:00
2017-10-03 17:54:25 -07:00
2017-11-14 15:32:19 -08:00
2017-11-15 18:21:06 -08:00
2017-11-02 11:10:55 +01:00
2017-11-17 12:54:01 -08:00
2017-04-17 12:52:27 -04:00
2017-11-17 11:54:55 -08:00
2017-11-29 18:40:42 -08:00
2017-11-15 18:21:04 -08:00
2017-11-14 15:32:19 -08:00
2017-11-02 11:10:55 +01:00
2017-07-03 21:13:25 -07:00
2017-11-17 16:56:17 -08:00
2017-11-29 18:40:42 -08:00
2017-11-15 08:08:36 -05:00
2017-11-17 12:54:01 -08:00
2017-11-15 18:21:04 -08:00
2017-11-17 12:54:01 -08:00
2017-11-02 11:10:55 +01:00
2017-11-07 10:32:44 +01:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-10 08:48:46 -05:00
2017-11-02 11:10:55 +01:00
2017-11-17 12:08:18 -08:00
2017-07-12 16:26:00 -07:00
2017-09-10 19:31:46 -04:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-29 18:40:43 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-29 18:40:43 -08:00
2017-11-08 15:16:36 -05:00
2017-11-27 13:05:09 -08:00
2017-09-05 12:53:12 +02:00
2017-11-17 16:10:03 -08:00
2017-05-23 08:41:17 -05:00
2017-11-27 13:05:09 -08:00
2017-11-17 12:08:18 -08:00
2017-11-07 10:32:44 +01:00
2017-11-17 11:54:55 -08:00
2017-11-02 11:10:55 +01:00
2017-11-17 11:54:55 -08:00
2017-10-25 11:01:08 +02:00
2017-11-02 11:10:55 +01:00
2017-11-27 13:05:09 -08:00
2017-11-17 12:54:01 -08:00
2017-11-14 15:32:19 -08:00
2017-11-02 11:10:55 +01:00
2017-11-15 18:21:05 -08:00
2017-11-02 11:10:55 +01:00
2017-10-04 18:03:15 +11:00