git: 550dede8754a - stable/13 - Fix "vrefact: wrong use count 0" with DRM

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 17 Jan 2025 18:47:12 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=550dede8754a1ddbf3e44894b20cb74c48111ccf

commit 550dede8754a1ddbf3e44894b20cb74c48111ccf
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2024-11-13 10:00:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-01-17 18:47:03 +0000

    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
    
    (cherry picked from commit fc595a6b76642dfdfdb8e6f9b9bbc734e95fb59c)
---
 sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 81127bf364f9..2697f02c0dd7 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -948,7 +948,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);
@@ -1680,7 +1680,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)