git: f581891cd16c - stable/15 - vfs_register: prevent kernel crash
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 25 Oct 2026 17:27:26 UTC
The branch stable/15 has been updated by netchild:
URL: https://cgit.FreeBSD.org/src/commit/?id=f581891cd16c21ba17ad820d163a8c20d72470d1
commit f581891cd16c21ba17ad820d163a8c20d72470d1
Author: Alexander Leidinger <netchild@FreeBSD.org>
AuthorDate: 2026-09-23 12:30:42 +0000
Commit: Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2026-10-25 17:27:22 +0000
vfs_register: prevent kernel crash
vfs_register hashes the filesystem name and uses it for sysctl oids.
A filesystem name which hashes to 0 crashes in sysctl_register_oid().
Map 0 to 1 to prevent the kernel crash.
This can be tested with "udf2" as the filesystem name.
MFC after: 1 month
MFC to: stable/15 stable/14
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D59839
(cherry picked from commit 3897678132e71df70dbb18bf8e2f19124beee5d7)
---
sys/kern/vfs_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index ceda770cb714..b4817f172edd 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -427,6 +427,8 @@ vfs_register(struct vfsconf *vfc)
*/
hashval = fnv_32_str(vfc->vfc_name, FNV1_32_INIT);
hashval &= 0xff;
+ if (hashval == 0)
+ hashval = 1;
secondpass = 0;
do {
/* Look for and fix any collision. */