mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 14:48:57 +00:00
fd_revoke() shouldn't panic if the descriptor provided is not a file or
socket. Return EINVAL instead. Submitted by: Ville-Pertti Keinone <will@iki.fi>
This commit is contained in:
parent
c137e096c2
commit
ce12799bad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54492
@ -256,17 +256,10 @@ fd_revoke(p, fd)
|
||||
if ((u_int)fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL)
|
||||
return EBADF;
|
||||
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_VNODE:
|
||||
vp = (struct vnode *) fp->f_data;
|
||||
|
||||
case DTYPE_SOCKET:
|
||||
if (fp->f_type != DTYPE_VNODE)
|
||||
return EINVAL;
|
||||
|
||||
default:
|
||||
panic("svr4_fcntl(F_REVOKE)");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
vp = (struct vnode *) fp->f_data;
|
||||
|
||||
if (vp->v_type != VCHR && vp->v_type != VBLK) {
|
||||
error = EINVAL;
|
||||
|
@ -256,17 +256,10 @@ fd_revoke(p, fd)
|
||||
if ((u_int)fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL)
|
||||
return EBADF;
|
||||
|
||||
switch (fp->f_type) {
|
||||
case DTYPE_VNODE:
|
||||
vp = (struct vnode *) fp->f_data;
|
||||
|
||||
case DTYPE_SOCKET:
|
||||
if (fp->f_type != DTYPE_VNODE)
|
||||
return EINVAL;
|
||||
|
||||
default:
|
||||
panic("svr4_fcntl(F_REVOKE)");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
vp = (struct vnode *) fp->f_data;
|
||||
|
||||
if (vp->v_type != VCHR && vp->v_type != VBLK) {
|
||||
error = EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user