Skip to content

Commit

Permalink
Fix reference count leak in fdescfs
Browse files Browse the repository at this point in the history
The reference used to be dropped in the `vn_vget_ino_gen` -> `fdesc_get_ino_alloc` path, however the `vn_vget_ino_gen` function has early return paths (depending on result of either `vfs_busy` or `VN_IS_DOOMED`), where the `fdesc_get_ino_alloc` callback, and thus the `fdrop` would not be reached.
  • Loading branch information
CTurt committed Mar 21, 2023
1 parent 68a930d commit 8b05d4b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys/fs/fdescfs/fdesc_vnops.c
Expand Up @@ -267,7 +267,7 @@ fdesc_get_ino_alloc(struct mount *mp, void *arg, int lkflags,
} else {
error = fdesc_allocvp(a->ftype, a->fd_fd, a->ix, mp, rvp);
}
fdrop(a->fp, a->td);

return (error);
}

Expand Down Expand Up @@ -364,6 +364,8 @@ fdesc_lookup(struct vop_lookup_args *ap)
arg.td = td;
error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg,
LK_EXCLUSIVE, &fvp);

fdrop(fp, td);
}

if (error)
Expand Down

0 comments on commit 8b05d4b

Please sign in to comment.