Fix "vrefact: wrong use count 0" with DRM

Bump the vnode use count, not its hold count. This fixes a panic triggered
by fstatat(..., AT_EMPTY_PATH) on DRM device nodes, which happens to be
what glxinfo(1) from Ubuntu Jammy is doing.

PR:		kern/274538
Reviewed By:	kib (earlier version), olce
Differential Revision:	https://reviews.freebsd.org/D47391
This commit is contained in:
Edward Tomasz Napierala 2024-11-13 10:00:38 +00:00
parent aa5d3dec9d
commit fc595a6b76

View file

@ -772,7 +772,7 @@ linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td,
}
/* hold on to the vnode - used for fstat() */
vhold(filp->f_vnode);
vref(filp->f_vnode);
/* release the file from devfs */
finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
@ -1504,7 +1504,7 @@ linux_file_close(struct file *file, struct thread *td)
error = -OPW(file, td, release(filp->f_vnode, filp));
funsetown(&filp->f_sigio);
if (filp->f_vnode != NULL)
vdrop(filp->f_vnode);
vrele(filp->f_vnode);
linux_drop_fop(ldev);
ldev = filp->f_cdev;
if (ldev != NULL)