Return-Path: Received: from vigilia.groessler.org ([79.143.177.135]:5050 "EHLO vigilia.groessler.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbcLGA31 (ORCPT ); Tue, 6 Dec 2016 19:29:27 -0500 Received: from blasi.groessler.org (gaga.groessler.org [212.168.189.235]) by vigilia.groessler.org (8.14.7/8.14.6) with ESMTP id uB70MJuQ019873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=OK) for ; Wed, 7 Dec 2016 01:22:19 +0100 (CET) To: stable@vger.kernel.org From: Christian Groessler Subject: fix kernel crash on stable/linux-3.4.y Message-ID: Date: Wed, 7 Dec 2016 01:22:00 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------AAD85AF70CCAD366A832853B" Sender: stable-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------AAD85AF70CCAD366A832853B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, the attached patch prevents a crash when trying to mount a corrupted ext4 file system. regards, chris --------------AAD85AF70CCAD366A832853B Content-Type: text/x-patch; name="0001-Fix-kernel-crash-when-trying-to-mount-corrupted-ext4.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Fix-kernel-crash-when-trying-to-mount-corrupted-ext4.pa"; filename*1="tch" >From 86344aebe7e3905b2293a7891a68def8cb38a571 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Wed, 7 Dec 2016 00:54:03 +0100 Subject: [PATCH] Fix kernel crash when trying to mount corrupted ext4 partition. ext4_calculate_overhead(), if successful, sets the 'ret' vatiable to 0. Subsequent failures will bail out, with the function returning the 'ret' variable as status. Since 'ret' is 0 (indicating no error) the kernel will happily continue and eventually crash. This change preserves the value of 'ret' across the call to ext4_calculate_overhead() in case this function doesn't return an error. Signed-off-by: Christian Groessler --- fs/ext4/super.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 5862518..0f63644 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3692,9 +3692,12 @@ no_journal: if (es->s_overhead_clusters) sbi->s_overhead = le32_to_cpu(es->s_overhead_clusters); else { + int oret = ret; ret = ext4_calculate_overhead(sb); if (ret) goto failed_mount_wq; + else + ret = oret; } /* -- 2.7.4 --------------AAD85AF70CCAD366A832853B--