Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 May 2021 23:09:51 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b2f9575646f8 - main - ffs: Correct the input size check in sysctl_ffs_fsck()
Message-ID:  <202105312309.14VN9pIY040212@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

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

commit b2f9575646f89cdddcad76acae3e9305535506a2
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-05-31 22:56:34 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-05-31 22:59:18 +0000

    ffs: Correct the input size check in sysctl_ffs_fsck()
    
    Make sure we return an error if no input was specified, since
    SYSCTL_IN() will report success in that case.
    
    Reported by:    KMSAN
    Reviewed by:    mckusick
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D30586
---
 sys/ufs/ffs/ffs_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index c7a1e2dec15e..c895c8c7bf07 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -3211,9 +3211,9 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
 	cap_rights_t rights;
 	int filetype, error;
 
-	if (req->newlen > sizeof cmd)
+	if (req->newptr == NULL || req->newlen > sizeof(cmd))
 		return (EBADRPC);
-	if ((error = SYSCTL_IN(req, &cmd, sizeof cmd)) != 0)
+	if ((error = SYSCTL_IN(req, &cmd, sizeof(cmd))) != 0)
 		return (error);
 	if (cmd.version != FFS_CMD_VERSION)
 		return (ERPCMISMATCH);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105312309.14VN9pIY040212>