Author: tsoome
Date: Wed Nov  7 21:36:52 2018
New Revision: 340240
URL: https://svnweb.freebsd.org/changeset/base/340240

Log:
  loader: ptable_open() check for ptable_cd9660read result is wrong
  
  The ptable_*read() functions return NULL on read errors (and partition table
  closed as an side effect). The ptable_open must check the return value and
  act properly.
  
  PR:           232483
  Reported by:  lev
  Reviewed by:  lev,cem
  Differential Revision:        https://reviews.freebsd.org/D17890

Modified:
  head/stand/common/part.c

Modified: head/stand/common/part.c
==============================================================================
--- head/stand/common/part.c    Wed Nov  7 21:01:14 2018        (r340239)
+++ head/stand/common/part.c    Wed Nov  7 21:36:52 2018        (r340240)
@@ -675,10 +675,12 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect
        table->type = PTABLE_NONE;
        STAILQ_INIT(&table->entries);
 
-       if (ptable_iso9660read(table, dev, dread) != NULL) {
-               if (table->type == PTABLE_ISO9660)
-                       goto out;
-       }
+       if (ptable_iso9660read(table, dev, dread) == NULL) {
+               /* Read error. */
+               table = NULL;
+               goto out;
+       } else if (table->type == PTABLE_ISO9660)
+               goto out;
 
 #ifdef LOADER_VTOC8_SUPPORT
        if (be16dec(buf + offsetof(struct vtoc8, magic)) == VTOC_MAGIC) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to