android_kernel_lge_bullhead/arch/mips
Yinghai Lu 6ccec4ea9c lib/decompressors: use real out buf size for gunzip with kernel
When loading x86 64bit kernel above 4GiB with patched grub2, got kernel
gunzip error.

| early console in decompress_kernel
| decompress_kernel:
|       input: [0x807f2143b4-0x807ff61aee]
|      output: [0x807cc00000-0x807f3ea29b] 0x027ea29c: output_len
| boot via startup_64
| KASLR using RDTSC...
|  new output: [0x46fe000000-0x470138cfff] 0x0338d000: output_run_size
|  decompress: [0x46fe000000-0x47007ea29b] <=== [0x807f2143b4-0x807ff61aee]
|
| Decompressing Linux... gz...
|
| uncompression error
|
| -- System halted

the new buffer is at 0x46fe000000ULL, decompressor_gzip is using
0xffffffb901ffffff as out_len.  gunzip in lib/zlib_inflate/inflate.c cap
that len to 0x01ffffff and decompress fails later.

We could hit this problem with crashkernel booting that uses kexec loading
kernel above 4GiB.

We have decompress_* support:
    1. inbuf[]/outbuf[] for kernel preboot.
    2. inbuf[]/flush() for initramfs
    3. fill()/flush() for initrd.
This bug only affect kernel preboot path that use outbuf[].

Add __decompress and take real out_buf_len for gunzip instead of guessing
wrong buf size.

Fixes: 1431574a1c4 (lib/decompressors: fix "no limit" output buffer length)
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Jon Medhurst <tixy@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-26 17:03:29 +02:00
..
alchemy
ar7
ath79 MIPS: ath79: make bootconsole wait for both THRE and TEMT 2016-08-21 23:22:41 +02:00
bcm47xx
bcm63xx
boot lib/decompressors: use real out buf size for gunzip with kernel 2019-08-26 17:03:29 +02:00
cavium-octeon MIPS: OCTEON: Fix copy_from_user fault handling for large buffers 2017-06-08 00:47:00 +02:00
cobalt
configs MIPS: ip27: Disable qlge driver in defconfig 2017-06-08 00:47:02 +02:00
dec
emma
fw
include This is the 3.10.108 stable release 2018-01-25 17:57:49 -07:00
jazz
jz4740
kernel This is the 3.10.108 stable release 2018-01-25 17:57:49 -07:00
kvm KVM: MIPS: Make ERET handle ERL before EXL 2017-02-06 09:04:07 +01:00
lantiq mips: dts: Fix missing device_type="memory" property in memory nodes 2014-06-07 13:25:28 -07:00
lasat
lib
loongson This is the 3.10.67 stable release 2015-05-01 13:34:57 -07:00
loongson1
math-emu MIPS: math-emu: Prevent wrong ISA mode instruction emulation 2017-11-01 22:12:44 +01:00
mm This is the 3.10.107 stable release 2018-01-25 17:57:41 -07:00
mti-malta MIPS: Malta: Fix IOCU disable switch read for MIPS64 2017-02-06 23:32:55 +01:00
mti-sead3
netlogic
oprofile MIPS: oprofile: Fix backtrace on 64-bit kernel 2014-12-06 15:05:46 -08:00
pci
pmcs-msp71xx
pnx833x
power nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
powertv
ralink mips: dts: Fix missing device_type="memory" property in memory nodes 2014-06-07 13:25:28 -07:00
rb532
sgi-ip22
sgi-ip27 mm: concentrate modification of totalram_pages into the mm core 2014-02-07 13:49:40 -08:00
sgi-ip32
sibyte
sni
txx9
vr41xx
wrppmc
Kbuild
Kbuild.platforms
Kconfig Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAP 2014-08-15 11:41:43 -07:00
Kconfig.debug
Makefile