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 3897678132)
This commit is contained in:
Alexander Leidinger committed 2026-10-25 18:27:22 +01:00
1 parent 0e9af9fb72
commit f581891cd1
1 file changed
+2
+2
View File
@@ -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. */