diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-14 00:09:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-14 00:09:41 +0000 |
commit | 02a365840c38e842976e2e6bfb8a24990aaa23e6 (patch) | |
tree | 40b28e93438bd0c49cdee7b2a2acc9bdab782d28 /sys/kern | |
parent | 7e97643755bb45a839c99309ba46c6c5b31c0669 (diff) |
Don't mess with the bounds in the lp if *partoffp is non-NULL, since this
indicates that writedisklabel is trying to find the location for writing
the label. If the lp is messed with, an invalid checksum is written.
done with miod and kettenis, lots of moaning and gnashing of teeth, etc
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_disk.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 2508c186ce1..d33a152d299 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.93 2009/06/05 00:41:13 deraadt Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.94 2009/06/14 00:09:40 deraadt Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -575,16 +575,18 @@ donot: lp->d_partitions['i' - 'a'].p_fstype = FS_MSDOS; } notfat: - DL_SETBSTART(lp, dospartoff); - DL_SETBEND(lp, dospartend < DL_GETDSIZE(lp) ? dospartend : DL_GETDSIZE(lp)); - /* record the OpenBSD partition's placement for the caller */ if (partoffp) *partoffp = dospartoff; + else { + DL_SETBSTART(lp, dospartoff); + DL_SETBEND(lp, + dospartend < DL_GETDSIZE(lp) ? dospartend : DL_GETDSIZE(lp)); + } /* don't read the on-disk label if we are in spoofed-only mode */ if (spoofonly) - return (NULL); + return (NULL); /* jump to the checkdisklabel below?? */ bp->b_blkno = DL_BLKTOSEC(lp, dospartoff + DOS_LABELSECTOR) * DL_BLKSPERSEC(lp); |