From owner-svn-src-all@freebsd.org Fri Dec 13 22:04:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47F231D8852; Fri, 13 Dec 2019 22:04:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ZPp60fRsz4Zdf; Fri, 13 Dec 2019 22:04:14 +0000 (UTC) (envelope-from avg@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 11A6A1ACD9; Fri, 13 Dec 2019 22:04:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBDM4DIC059813; Fri, 13 Dec 2019 22:04:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBDM4DJj059812; Fri, 13 Dec 2019 22:04:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912132204.xBDM4DJj059812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 13 Dec 2019 22:04:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355736 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 355736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Fri, 13 Dec 2019 22:04:14 -0000 Author: avg Date: Fri Dec 13 22:04:13 2019 New Revision: 355736 URL: https://svnweb.freebsd.org/changeset/base/355736 Log: zfs boot: fix a crash in a rarely taken path in fzap_lookup Instead of passing NULL to fzap_name_equal and crashing, just return ENOENT. This happened when higher bits of a hash of the searched key (its hash prefix) matched a hash prefix of some key in the ZAP, but the full hash value of the searched key did not match any key in the ZAP. I observerved this problem when loader tried to look up "features_for_read" in a particular old pool that predates pool features. MFC after: 2 weeks Sponsored by: Panzura Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Fri Dec 13 21:39:20 2019 (r355735) +++ head/stand/libsa/zfs/zfsimpl.c Fri Dec 13 22:04:13 2019 (r355736) @@ -2282,10 +2282,8 @@ fzap_lookup(const spa_t *spa, const dnode_phys_t *dnod return (ENOENT); zc = &ZAP_LEAF_CHUNK(&zl, h); while (zc->l_entry.le_hash != hash) { - if (zc->l_entry.le_next == 0xffff) { - zc = NULL; - break; - } + if (zc->l_entry.le_next == 0xffff) + return (ENOENT); zc = &ZAP_LEAF_CHUNK(&zl, zc->l_entry.le_next); } if (fzap_name_equal(&zl, zc, name)) {