Monitor: check spare group is non-NULL before adding to domain list

... otherwise we crash.

Reported-by: "Labun, Marcin" <Marcin.Labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2010-11-23 11:11:45 +11:00
parent 2cda7640f9
commit 062dc4817d
1 changed files with 3 additions and 1 deletions

View File

@ -732,7 +732,9 @@ static int move_spare(struct state *from, struct state *to,
continue;
pol = devnum_policy(from->devid[d]);
pol_add(&pol, pol_domain, from->spare_group, NULL);
if (from->spare_group)
pol_add(&pol, pol_domain,
from->spare_group, NULL);
if (domain_test(domlist, pol, to->metadata->ss->name))
dev = from->devid[d];
dev_policy_free(pol);