From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753635AbdGYUHl (ORCPT ); Tue, 25 Jul 2017 16:07:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35524 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753410AbdGYTXm (ORCPT ); Tue, 25 Jul 2017 15:23:42 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anton Blanchard , Ankit Kumar , Mahesh Salgaonkar , Kees Cook Subject: [PATCH 4.12 028/196] pstore: Dont warn if data is uncompressed and type is not PSTORE_TYPE_DMESG Date: Tue, 25 Jul 2017 12:20:27 -0700 Message-Id: <20170725192047.687818591@linuxfoundation.org> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170725192046.422343510@linuxfoundation.org> References: <20170725192046.422343510@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ankit Kumar commit 4a16d1cb245c56e72fd40a28f3cdb394cde4b341 upstream. commit 9abdcccc3d5f ("pstore: Extract common arguments into structure") moved record decompression to function. decompress_record() gets called without checking type and compressed flag. Warning will be reported if data is uncompressed. Pstore type PSTORE_TYPE_PPC_OPAL, PSTORE_TYPE_PPC_COMMON doesn't contain compressed data and warning get printed part of dmesg. Partial dmesg log: [ 35.848914] pstore: ignored compressed record type 6 [ 35.848927] pstore: ignored compressed record type 8 Above warning should not get printed as it is known that data won't be compressed for above type and it is valid condition. This patch returns if data is not compressed and print warning only if data is compressed and type is not PSTORE_TYPE_DMESG. Reported-by: Anton Blanchard Signed-off-by: Ankit Kumar Reviewed-by: Mahesh Salgaonkar Signed-off-by: Kees Cook Fixes: 9abdcccc3d5f ("pstore: Extract common arguments into structure") Signed-off-by: Greg Kroah-Hartman --- fs/pstore/platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -770,8 +770,11 @@ static void decompress_record(struct pst int unzipped_len; char *decompressed; + if (!record->compressed) + return; + /* Only PSTORE_TYPE_DMESG support compression. */ - if (!record->compressed || record->type != PSTORE_TYPE_DMESG) { + if (record->type != PSTORE_TYPE_DMESG) { pr_warn("ignored compressed record type %d\n", record->type); return; }