Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1462447
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.7 36/41] ext4: check for extents that wrap around |
| Date | 2016-08-14 22:50 +0200 |
| Message-ID | <s6aw3-4AX-103@gated-at.bofh.it> (permalink) |
| References | <s6aw1-4AX-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vegard Nossum <vegard.nossum@oracle.com>
commit f70749ca42943faa4d4dcce46dfdcaadb1d0c4b6 upstream.
An extent with lblock = 4294967295 and len = 1 will pass the
ext4_valid_extent() test:
ext4_lblk_t last = lblock + len - 1;
if (len == 0 || lblock > last)
return 0;
since last = 4294967295 + 1 - 1 = 4294967295. This would later trigger
the BUG_ON(es->es_lblk + es->es_len < es->es_lblk) in ext4_es_end().
We can simplify it by removing the - 1 altogether and changing the test
to use lblock + len <= lblock, since now if len = 0, then lblock + 0 ==
lblock and it fails, and if len > 0 then lblock + len > lblock in order
to pass (i.e. it doesn't overflow).
Fixes: 5946d0893 ("ext4: check for overlapping extents in ext4_valid_extent_entries()")
Fixes: 2f974865f ("ext4: check for zero length extent explicitly")
Cc: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ext4/extents.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -381,9 +381,13 @@ static int ext4_valid_extent(struct inod
ext4_fsblk_t block = ext4_ext_pblock(ext);
int len = ext4_ext_get_actual_len(ext);
ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
- ext4_lblk_t last = lblock + len - 1;
- if (len == 0 || lblock > last)
+ /*
+ * We allow neither:
+ * - zero length
+ * - overflow/wrap-around
+ */
+ if (lblock + len <= lblock)
return 0;
return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.7 00/41] 4.7.1-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 15/41] KEYS: 64-bit MIPS needs to use compat_sys_keyctl for 32-bit userspace Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 36/41] ext4: check for extents that wrap around Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 13/41] tcp: consider recv buf for the initial window scale Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 04/41] udp: use sk_filter_trim_cap for udp{,6}_queue_rcv_skb Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 34/41] crypto: scatterwalk - Fix test in scatterwalk_done Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 37/41] ext4: fix deadlock during page writeback Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 10/41] net/sctp: terminate rhashtable walk correctly Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 35/41] serial: mvebu-uart: free the IRQ in ->shutdown() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 22:50 +0200
[PATCH 4.7 27/41] fuse: fsync() did not return IO errors Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 19/41] mm: memcontrol: fix swap counter leak on swapout from offline cgroup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 03/41] vfs: fix deadlock in file_remove_privs() on overlayfs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 29/41] fuse: fix wrong assignment of ->flags in fuse_send_init() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 21/41] x86/syscalls/64: Add compat_sys_keyctl for 32-bit userspace Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 11/41] qed: Fix setting/clearing bit in completion bitmap Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 30/41] Revert "mm, mempool: only set __GFP_NOMEMALLOC if there are free elements" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 20/41] mm: memcontrol: fix memcg id ref counter on swap charge move Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 17/41] apparmor: fix ref count leak when profile sha1 hash is read Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
[PATCH 4.7 25/41] x86/microcode: Fix suspend to RAM with builtin microcode Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-14 23:00 +0200
Re: [PATCH 4.7 00/41] 4.7.1-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-15 10:00 +0200
Re: [PATCH 4.7 00/41] 4.7.1-stable review Kevin Hilman <khilman@baylibre.com> - 2016-08-15 23:40 +0200
Re: [PATCH 4.7 00/41] 4.7.1-stable review Guenter Roeck <linux@roeck-us.net> - 2016-08-15 15:10 +0200
Re: [PATCH 4.7 00/41] 4.7.1-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-15 15:50 +0200
Re: [PATCH 4.7 00/41] 4.7.1-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-08-16 06:10 +0200
Re: [PATCH 4.7 00/41] 4.7.1-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-16 12:50 +0200
csiph-web