From nobody Sat May 27 05:43:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QSrLp3SCRz4WXls; Sat, 27 May 2023 05:43:46 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QSrLp1XZCz51hQ; Sat, 27 May 2023 05:43:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685166226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Opuqcz+wij+ZWo8acn6Hr+ZhgA/GlmmrjHFr+msAnU0=; b=YGUFop3qJH1gMP5nI8j4C9QK83JEzH345xfGk+3Nnco/d6T+2sEXu8jceqy2nVj8insKpZ Uwk+8sVrOTM1gzkpCnALz7McoIPK3K8ezFHwCVdzOTFCY67Z051uxDdlJCMDHVcWhybexk ek8auKkursHA9j+YDoACevuu5ENPfwhiRipxs5/Xrl+lzcO22JxIMUUKnsgAhFP5hMFUDb FGJ8JS/InFbvFxLkYSdeleESni+Py+lJfvyuNaB1plyVB82ijMXhezgPNuTaEA3RMcptxr mNdzBmHOMWC4qE9TOH4jZ6C8cAuOUEF3y86HCz33j/KCFxiOFztSesPgXdWy7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685166226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Opuqcz+wij+ZWo8acn6Hr+ZhgA/GlmmrjHFr+msAnU0=; b=CH30a3gF/Yq0djsWt46rPqczPwQodCGL2ft3VnRB5E9UVOwYf4Z+whE0mnh6w6Ghq2jsX5 8/5gdilbl8bYIclT6kbfVC6S7S7O218UmCjAZuCiUlkLd9L505XlUULDpQNTQl7rVEjlqC hm9KyDthTHRWg+zF00oEH0VSwR9+gsFVLebGW9cfmrIxSpnW7QYT+ddi8Sq9QJKj1H1jg3 xXYIp9j6nMyn5j5ZoLSH4UcdX91FWrirZyRuDWQRKNKrMcqUBpz6ABtCe7MHyfhcbMIhr7 XDfh/k2pz5nXYBTPnGCYL6woJzd39nKKTiL/34udhlRNRmbgrpn2WRzaEqVaaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685166226; a=rsa-sha256; cv=none; b=Gfo+/K8h7EmYhgSr1M8/pWvHECWmzVR0YkObn2GLWMYeOoIfUvkSKJbeIWMnJO5hLBHt/x 5/hbndlV3nFp0nFTTzRairpUW8CGzKSnB0dlgEpqThbekqapQHsPT7yrlM3UYZ3GwpSMiP naOvTnqpi6koQMGiREci3Xixbo3vN7gEngLYZmLr69HNascyPH57iTidChqe3UusSHwrfs 5HfKNenK0LQZClQMWgn5KuTBSQO6KbeiE/oue8+APziCyw9kSJOl9KhdkqGNPsjwCywr3n e/srubpf0hvMsF0HDMqb3iWuXg7/wt2aIdrZYjxRS5KLl1eo1ZKfr7CWCS3obA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QSrLp0d1Szcv9; Sat, 27 May 2023 05:43:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34R5hjeV061332; Sat, 27 May 2023 05:43:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34R5hjF8061331; Sat, 27 May 2023 05:43:45 GMT (envelope-from git) Date: Sat, 27 May 2023 05:43:45 GMT Message-Id: <202305270543.34R5hjF8061331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 03a8680202ef - main - Correct two bugs in fsck_ffs(8) triggered by corrupted filesystems. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03a8680202ef7d7e68adc70625633c490b4ed637 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=03a8680202ef7d7e68adc70625633c490b4ed637 commit 03a8680202ef7d7e68adc70625633c490b4ed637 Author: Kirk McKusick AuthorDate: 2023-05-27 05:41:57 +0000 Commit: Kirk McKusick CommitDate: 2023-05-27 05:43:21 +0000 Correct two bugs in fsck_ffs(8) triggered by corrupted filesystems. Always create a directory inode structure when a directory inode is found in Pass 1 as it is not known whether it will be saved or removed in later passes. If it is to be saved the directory inode structure is needed to track its status and fsck_ffs(8) will segment fault if it does not exist. Reported-by: Robert Morris PR: 271310 PR: 271354 MFC-after: 1 week Sponsored-by: The FreeBSD Foundation --- sbin/fsck_ffs/pass1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index e784fd29dc1c..863bf34ff0fc 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -400,13 +400,13 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuiltcg) if (mode == IFDIR) { if (DIP(dp, di_size) == 0) { inoinfo(inumber)->ino_state = DCLEAR; - } else if (DIP(dp, di_nlink) <= 0) { + } else if (DIP(dp, di_nlink) == 0) { inoinfo(inumber)->ino_state = DZLINK; } else { inoinfo(inumber)->ino_state = DSTATE; - cacheino(dp, inumber); - countdirs++; } + cacheino(dp, inumber); + countdirs++; } else if (DIP(dp, di_nlink) <= 0) inoinfo(inumber)->ino_state = FZLINK; else