]> git.karo-electronics.de Git - karo-tx-linux.git/commit
md: linear: Fix a division by zero bug for very small arrays.
authorAndre Noll <maan@systemlinux.org>
Fri, 7 Nov 2008 00:07:46 +0000 (00:07 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 13 Nov 2008 17:55:57 +0000 (09:55 -0800)
commit83e387d13a81dab114b5f818f3c4abafcb9c7d2c
tree8f561648302e144f2ff9aa6e5c305c45838343d5
parente61227530bdc9092c938a6150edcddb28f3042f6
md: linear: Fix a division by zero bug for very small arrays.

commit f1cd14ae52985634d0389e934eba25b5ecf24565 upstream

Date: Thu, 6 Nov 2008 19:41:24 +1100
Subject: md: linear: Fix a division by zero bug for very small arrays.

We currently oops with a divide error on starting a linear software
raid array consisting of at least two very small (< 500K) devices.

The bug is caused by the calculation of the hash table size which
tries to compute sector_div(sz, base) with "base" being zero due to
the small size of the component devices of the array.

Fix this by requiring the hash spacing to be at least one which
implies that also "base" is non-zero.

This bug has existed since about 2.6.14.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/linear.c