]> git.ipfire.org Git - thirdparty/mdadm.git/commit
Detect too-small device: error rather than underflow/crash
authorDavid Favro <dfavro@meta-dynamic.com>
Sat, 23 May 2020 12:24:59 +0000 (08:24 -0400)
committerJes Sorensen <jsorensen@fb.com>
Fri, 5 Jun 2020 15:21:13 +0000 (11:21 -0400)
commit2cf0433063203fca10d26629c9e090b51fb1d806
tree75af8d9e197d50a217aef3f0a036b51351d93347
parent7758ada9f3872cc9cb4c76c733dbc553562b3d7d
Detect too-small device: error rather than underflow/crash

For 1.x metadata, when the user requested creation of an array on
component devices that were too small even to hold the superblock,
an undetected integer wraparound (underflow) resulted in an enormous
computed size which resulted in various follow-on errors such as
floating-point exception.

This patch detects this condition, prints a reasonable diagnostic
message, and refuses to continue.

Signed-off-by: David Favro <dfavro@meta-dynamic.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
super1.c