git: d13215b99d0b - stable/12 - pseudofs: limit writes to 1M

Konstantin Belousov kib at FreeBSD.org
Sat May 1 00:39:16 UTC 2021


The branch stable/12 has been updated by kib:

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

commit d13215b99d0b9d04de111dd469938e6854fc3493
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-04-13 19:48:44 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-05-01 00:38:30 +0000

    pseudofs: limit writes to 1M
    
    (cherry picked from commit 5edf7227ec339f651c7328e63df323f6ef10345f)
---
 sys/fs/pseudofs/pseudofs_vnops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c
index 6c025547b71b..510b6936d2fa 100644
--- a/sys/fs/pseudofs/pseudofs_vnops.c
+++ b/sys/fs/pseudofs/pseudofs_vnops.c
@@ -996,6 +996,9 @@ pfs_write(struct vop_write_args *va)
 	if (pn->pn_fill == NULL)
 		PFS_RETURN (EIO);
 
+	if (uio->uio_resid > PFS_MAXBUFSIZ)
+		PFS_RETURN (EIO);
+
 	/*
 	 * This is necessary because either process' privileges may
 	 * have changed since the open() call.


More information about the dev-commits-src-all mailing list