summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-10-05 11:24:21 +0000
committerbrian <brian@FreeBSD.org>2002-10-05 11:24:21 +0000
commit89d8005f0102ab344020eebd41193f2045c526f7 (patch)
tree06d011fa205975a7cfc45bf358d8be1841a048fa /sys/kern/subr_disk.c
parent747ba408ec03eaa78f011c520d58c7e52de2de00 (diff)
downloadFreeBSD-src-89d8005f0102ab344020eebd41193f2045c526f7.zip
FreeBSD-src-89d8005f0102ab344020eebd41193f2045c526f7.tar.gz
If dsgetlabel() returns a label with a size of zero in diskdumpconf(),
treat it as an invalid partition. This fixes a bug where ``dumpon <device>'' will configure the dump device at a random offset on the disk if <device> isn't a valid partition. Reviewed by: phk
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 6408250..d6c6643 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -221,6 +221,8 @@ diskdumpconf(u_int onoff, dev_t dev, struct disk *dp)
dp->d_slice->dss_slices[dkslice(dev)].ds_offset) * DEV_BSIZE;
di.mediasize =
(off_t)(dl->d_partitions[dkpart(dev)].p_size) * DEV_BSIZE;
+ if (di.mediasize == 0)
+ return (EINVAL);
return(set_dumper(&di));
}
OpenPOWER on IntegriCloud