powerpc/pseries: Fix buffer overflow when reading from pstore
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Thu, 8 Aug 2013 17:03:49 +0000 (22:33 +0530)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 9 Aug 2013 08:06:40 +0000 (18:06 +1000)
commit7e76f34fa103677a27d96a7cfef8ce61389a32de
treefe4ceca869426702d81b5dbf0a924adbd9708725
parent4e90a2a7375e86827541bda9393414c03e7721c6
powerpc/pseries: Fix buffer overflow when reading from pstore

When reading from pstore there is a buffer overflow during decompression
due to the header added in unzip_oops. Remove unzip_oops and call
pstore_decompress directly in nvram_pstore_read. Allocate buffer of size
report_length of the oops header as header will not be deallocated in pstore.
Since we have 'openssl' command line tool to decompress the compressed data,
dump the compressed data in case decompression fails instead of not dumping
anything.

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/nvram.c