Author: smh
Date: Thu Jan 28 12:15:50 2016
New Revision: 294982
URL: https://svnweb.freebsd.org/changeset/base/294982

Log:
  MFC r294059:
  
  Ensure boot fsread correctly probes all partitions
  
  Sponsored by: Multiplay

Modified:
  stable/10/sys/boot/common/ufsread.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/common/ufsread.c
==============================================================================
--- stable/10/sys/boot/common/ufsread.c Thu Jan 28 12:11:42 2016        
(r294981)
+++ stable/10/sys/boot/common/ufsread.c Thu Jan 28 12:15:50 2016        
(r294982)
@@ -187,8 +187,15 @@ fsread(ufs_ino_t inode, void *buf, size_
 
        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))
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to