fix kernel crash on stable/linux-3.4.y
Subsystems (2)
Hi,
the attached patch prevents a crash when trying to mount a corrupted ext4 file system.
regards,
chris
Quoted 1 line
From
86344aebe7e3905b2293a7891a68def8cb38a571Mon Sep 17 00:00:00 2001
From: Christian Groessler <[email protected]>
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.
--- fs/ext4/super.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/super.c +3 -0
@@ -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; }/*
Signature · 1 line
2.7.4
Hi,
Quoted 4 lines · Christian Groessler
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.
Quoted 3 lines
regards,
chris
Thanks,
Willy
---
Quoted 40 lines
Quoted 1 line
From
86344aebe7e3905b2293a7891a68def8cb38a571Mon Sep 17 00:00:00 2001From: Christian Groessler <[email protected]>
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 <[email protected]>--- fs/ext4/super.c | 3 +++ 1 file changed, 3 insertions(+)fs/ext4/super.c +3
-0@@ -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; }/* Signature · 1 line
2.7.4
Hi,
Quoted 6 lines · Willy Tarreau
Quoted 4 lines · Christian Groessler
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 ?
Good question.
Quoted 2 lines
Is mainline
not affected by the same bug ?
The bug was fixed in mainline with commit 07aa2ea13814e.
I will backport that and resubmit.
regards,
chris
Greg KH
maintainerQuoted 4 lines · Christian Groessler
Hi,
the attached patch prevents a crash when trying to mount a corrupted ext4 file system.
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly.
</formletter>