mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-09 04:36:31 +00:00
ufs: Update *eofflag upon a read of an unlinked directory
If the directory is unlinked, no further entries will be returned, but we return no error. At least one caller (vn_dir_next_dirent()) asserts that a VOP_READDIR call which returns no error and no entries will set *eofflag != 0, so the current behaviour of UFS can trigger an assertion failure. Simply set *eofflag in this scenario. Reviewed by: olce, kib Reported by: syzkaller MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43089
This commit is contained in:
parent
881bf8814a
commit
3ff574c5e1
|
@ -2417,8 +2417,10 @@ ufs_readdir(
|
|||
if (uio->uio_offset < 0)
|
||||
return (EINVAL);
|
||||
ip = VTOI(vp);
|
||||
if (ip->i_effnlink == 0)
|
||||
if (ip->i_effnlink == 0) {
|
||||
*ap->a_eofflag = 1;
|
||||
return (0);
|
||||
}
|
||||
if (ap->a_ncookies != NULL) {
|
||||
if (uio->uio_resid < 0)
|
||||
ncookies = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user