mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 10:10:24 -04:00
Bail out of corrupt directory entries during boot
A directory with a zero-valued d_reclen causes boot to hang, This patch checks for directory entries with value zero and bails out rather than spin forever. The hope is that the user has other options. Sadly this was reported on Jun 16 2015 and is just now attended to as part of a sweep of old unclosed phabricator reports. Reported-by: Daniel O'Connor darius-dons.net.au Differential Revision: https://reviews.freebsd.org/D2844 MFC-after: 1 week Sponsored-by: Netflix
This commit is contained in:
parent
510e473ff3
commit
690ae8a202
2 changed files with 13 additions and 0 deletions
|
|
@ -891,6 +891,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue