[PATCH 06/27] DDF: ddf_open_new: implement minimal consistency check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Added a minimal consitency check as in imsm_open_new().

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 super-ddf.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/super-ddf.c b/super-ddf.c
index b3c846d..ae24bb9 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -3695,8 +3695,14 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
  */
 static int ddf_open_new(struct supertype *c, struct active_array *a, char *inst)
 {
-	dprintf("ddf: open_new %s\n", inst);
-	a->info.container_member = atoi(inst);
+	struct ddf_super *ddf = c->sb;
+	int n = atoi(inst);
+	if (n >= (int)__be16_to_cpu(ddf->virt->populated_vdes)) {
+		pr_err("%s: subarray index %d out of range\n", __func__, n);
+		return -ENODEV;
+	}
+	dprintf("ddf: open_new %d\n", n);
+	a->info.container_member = n;
 	return 0;
 }
 
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux