From 8b5dc50539615fa69e9ab67431908e0e9072482d Mon Sep 17 00:00:00 2001 From: smh Date: Thu, 28 Jan 2016 12:15:50 +0000 Subject: MFC r294059: Ensure boot fsread correctly probes all partitions Sponsored by: Multiplay --- sys/boot/common/ufsread.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/boot/common/ufsread.c b/sys/boot/common/ufsread.c index acff1e5..08ab697 100644 --- a/sys/boot/common/ufsread.c +++ b/sys/boot/common/ufsread.c @@ -187,8 +187,15 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte) blkbuf = dmadat->blkbuf; indbuf = dmadat->indbuf; - if (!dsk_meta) { + + /* + * Force probe if inode is zero to ensure we have a valid fs, otherwise + * when probing multiple paritions, reads from subsequent parititions + * will incorrectly succeed. + */ + if (!dsk_meta || inode == 0) { inomap = 0; + dsk_meta = 0; for (n = 0; sblock_try[n] != -1; n++) { if (dskread(dmadat->sbbuf, sblock_try[n] / DEV_BSIZE, SBLOCKSIZE / DEV_BSIZE)) -- cgit v1.1