Author: ae
Date: Thu Feb  3 11:09:27 2011
New Revision: 218216
URL: http://svn.freebsd.org/changeset/base/218216

Log:
  MFC r217924:
    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.

Modified:
  stable/8/sys/geom/part/g_part_bsd.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/geom/part/g_part_bsd.c
==============================================================================
--- stable/8/sys/geom/part/g_part_bsd.c Thu Feb  3 10:44:40 2011        
(r218215)
+++ stable/8/sys/geom/part/g_part_bsd.c Thu Feb  3 11:09:27 2011        
(r218216)
@@ -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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to