From owner-svn-src-all@freebsd.org Thu Nov 29 13:01:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01401113AB7F; Thu, 29 Nov 2018 13:01:23 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C9776A06F; Thu, 29 Nov 2018 13:01:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F37D19E1B; Thu, 29 Nov 2018 13:01:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wATD1M5D016105; Thu, 29 Nov 2018 13:01:22 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wATD1MDK016104; Thu, 29 Nov 2018 13:01:22 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201811291301.wATD1MDK016104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 29 Nov 2018 13:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341225 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 341225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C9776A06F X-Spamd-Result: default: False [0.72 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_LONG(0.26)[0.262,0]; NEURAL_SPAM_MEDIUM(0.19)[0.193,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.26)[0.261,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2018 13:01:23 -0000 Author: tsoome Date: Thu Nov 29 13:01:21 2018 New Revision: 341225 URL: https://svnweb.freebsd.org/changeset/base/341225 Log: MFC: r340240: 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: stable/12/stand/common/part.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/part.c ============================================================================== --- stable/12/stand/common/part.c Thu Nov 29 12:12:42 2018 (r341224) +++ stable/12/stand/common/part.c Thu Nov 29 13:01:21 2018 (r341225) @@ -676,10 +676,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) {