Date: Sat, 30 Aug 2025 22:58:14 GMT From: Kirk McKusick <mckusick@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 727bc500264b - stable/14 - Bail out of corrupt directory entries during boot Message-ID: <202508302258.57UMwEJ9080562@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=727bc500264bffc48b699a88e00a0baa14cbe73d commit 727bc500264bffc48b699a88e00a0baa14cbe73d Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2025-08-22 05:33:48 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2025-08-30 22:56:26 +0000 Bail out of corrupt directory entries during boot Reported-by: Daniel O'Connor darius-dons.net.au MFC-after: 1 week Sponsored-by: Netflix Differential-Revision: https://reviews.freebsd.org/D2844 (cherry picked from commit 690ae8a2025ca1ce58d08a90a1df1645c81392ea) --- stand/libsa/ufs.c | 6 ++++++ stand/libsa/ufsread.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/stand/libsa/ufs.c b/stand/libsa/ufs.c index e1d540ed2321..7782ba370272 100644 --- a/stand/libsa/ufs.c +++ b/stand/libsa/ufs.c @@ -890,6 +890,12 @@ ufs_readdir(struct open_file *f, struct dirent *d) if (error) return (error); dp = (struct direct *)buf; + /* + * Check for corrupt directory entry and bail out rather + * than spin forever hoping that the user has other options. + */ + if (dp->d_reclen == 0) + return (0); fp->f_seekp += dp->d_reclen; } while (dp->d_ino == (ino_t)0); diff --git a/stand/libsa/ufsread.c b/stand/libsa/ufsread.c index 0f9b9bb4e2fb..86ac8fbbbab7 100644 --- a/stand/libsa/ufsread.c +++ b/stand/libsa/ufsread.c @@ -108,6 +108,13 @@ fsfind(const char *name, ufs_ino_t * ino) *ino = d.d_ino; return d.d_type; } + /* + * Check for corrupt directory entry and bail out + * rather than spin forever hoping that the user + * has other options. + */ + if (d.d_reclen == 0) + return 0; s += d.d_reclen; } if (n != -1 && ls)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202508302258.57UMwEJ9080562>