Return-Path: Received: from wtarreau.pck.nerim.net ([62.212.114.60]:19081 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbcLGGek (ORCPT ); Wed, 7 Dec 2016 01:34:40 -0500 Date: Wed, 7 Dec 2016 07:30:48 +0100 From: Willy Tarreau To: Christian Groessler Cc: stable@vger.kernel.org Subject: Re: fix kernel crash on stable/linux-3.4.y Message-ID: <20161207063048.GB15988@1wt.eu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: Hi, On Wed, Dec 07, 2016 at 01:22:00AM +0100, Christian Groessler wrote: > Hi, > > the attached patch prevents a crash when trying to mount a corrupted ext4 > file system. Why isn't it a backport of the equivalent mainline commit ? Is mainline not affected by the same bug ? Unless this is the case (and the mainline commit which made this one unnecessary) all fixes must go to mainline first before being backported to stable. > regards, > chris > Thanks, Willy --- > >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 >