git: d8703cd80247 - main - vfs: Return early from sysctl_vfs_ctl() if no input was given
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 20 Mar 2025 02:53:17 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d8703cd80247ca203b817305753bda2b7dbfb5ef commit d8703cd80247ca203b817305753bda2b7dbfb5ef Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-03-20 01:34:18 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-03-20 01:34:18 +0000 vfs: Return early from sysctl_vfs_ctl() if no input was given Otherwise we end up searching for a mountpoint using an uninitialized key, and likely failing the version test. This violates KMSAN's invariants, so simply return immediately instead. MFC after: 2 weeks --- sys/kern/vfs_subr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 95ed98d3217d..96e8bb765972 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -6519,6 +6519,8 @@ sysctl_vfs_ctl(SYSCTL_HANDLER_ARGS) int error; struct mount *mp; + if (req->newptr == NULL) + return (EINVAL); error = SYSCTL_IN(req, &vc, sizeof(vc)); if (error) return (error);