svn commit: r217924 - head/sys/geom/part

Andrey V. Elsukov ae at FreeBSD.org
Thu Jan 27 08:02:26 UTC 2011


Author: ae
Date: Thu Jan 27 08:02:26 2011
New Revision: 217924
URL: http://svn.freebsd.org/changeset/base/217924

Log:
  While inspecting the disklabel check that start offset of partition is
  within provider's bounds. If not then reject this disklabel.
  Mark bbarea as NULL to do not free it again in destroy method.
  
  MFC after:	1 week

Modified:
  head/sys/geom/part/g_part_bsd.c

Modified: head/sys/geom/part/g_part_bsd.c
==============================================================================
--- head/sys/geom/part/g_part_bsd.c	Thu Jan 27 07:33:17 2011	(r217923)
+++ head/sys/geom/part/g_part_bsd.c	Thu Jan 27 08:02:26 2011	(r217924)
@@ -426,6 +426,8 @@ g_part_bsd_read(struct g_part_table *bas
 			continue;
 		if (part.p_offset < table->offset)
 			continue;
+		if (part.p_offset - table->offset > basetable->gpt_last)
+			goto invalid_label;
 		baseentry = g_part_new_entry(basetable, index + 1,
 		    part.p_offset - table->offset,
 		    part.p_offset - table->offset + part.p_size - 1);
@@ -440,6 +442,7 @@ g_part_bsd_read(struct g_part_table *bas
  invalid_label:
 	printf("GEOM: %s: invalid disklabel.\n", pp->name);
 	g_free(table->bbarea);
+	table->bbarea = NULL;
 	return (EINVAL);
 }
 


More information about the svn-src-head mailing list