summaryrefslogtreecommitdiffstats
path: root/sys/fs/devfs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-10-25 16:33:24 +0000
committerkib <kib@FreeBSD.org>2013-10-25 16:33:24 +0000
commit3056ea94bbf733ca0aeeb7772efef40884382338 (patch)
tree8cdc43bc7a031b40ce768ad7193ec70f127507b9 /sys/fs/devfs
parentf2cf20f78fcdd44d412de89a584d6d98ef5c585c (diff)
downloadFreeBSD-src-3056ea94bbf733ca0aeeb7772efef40884382338.zip
FreeBSD-src-3056ea94bbf733ca0aeeb7772efef40884382338.tar.gz
MFC r256502:
Similar to debug.iosize_max_clamp sysctl, introduce devfs_iosize_max_clamp sysctl, which allows/disables SSIZE_MAX-sized i/o requests on the devfs files. Approved by: re (glebius)
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r--sys/fs/devfs/devfs_vnops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index dcc10c87..a05299a 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -1178,6 +1178,8 @@ devfs_read_f(struct file *fp, struct uio *uio, struct ucred *cred,
struct cdevsw *dsw;
struct file *fpop;
+ if (uio->uio_resid > DEVFS_IOSIZE_MAX)
+ return (EINVAL);
fpop = td->td_fpop;
error = devfs_fp_check(fp, &dev, &dsw, &ref);
if (error)
@@ -1653,6 +1655,8 @@ devfs_write_f(struct file *fp, struct uio *uio, struct ucred *cred,
struct cdevsw *dsw;
struct file *fpop;
+ if (uio->uio_resid > DEVFS_IOSIZE_MAX)
+ return (EINVAL);
fpop = td->td_fpop;
error = devfs_fp_check(fp, &dev, &dsw, &ref);
if (error)
OpenPOWER on IntegriCloud