From: NeilBrown Date: Wed, 13 May 2015 04:08:41 +0000 (+1000) Subject: Manage: when re-adding, do check avail size if ->sb cannot be found. X-Git-Tag: mdadm-3.3.3~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2609f339028a6035a3fadb1190b565438000e35c;p=thirdparty%2Fmdadm.git Manage: when re-adding, do check avail size if ->sb cannot be found. avail_size1 requires ->sb, so we must only call it if ->sb was loaded. If ->sb wasn't loaded, then we are only proceding on the basis that the kernel might be able to work something out - we don't need to do any tests on size. Reported-by: Christoffer Hammarström Signed-off-by: NeilBrown URL: https://bugs.debian.org/784874 --- diff --git a/Manage.c b/Manage.c index 225af813..2e602d74 100644 --- a/Manage.c +++ b/Manage.c @@ -781,7 +781,8 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv, } /* Make sure device is large enough */ - if (tst->ss->avail_size(tst, ldsize/512, INVALID_SECTORS) < + if (tst->sb && + tst->ss->avail_size(tst, ldsize/512, INVALID_SECTORS) < array_size) { if (dv->disposition == 'M') return 0;