git: e6025bc05cda - stable/14 - Fix "vrefact: wrong use count 0" with DRM
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Jan 2025 18:46:58 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=e6025bc05cda3a33ac9e9d9e1b0a5677956f0d47
commit e6025bc05cda3a33ac9e9d9e1b0a5677956f0d47
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:43:42 +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 1fc71c55469a..b60f464377cc 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -773,7 +773,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);
@@ -1505,7 +1505,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)