diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-07-25 02:44:23 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-07-25 02:44:23 +0000 |
commit | e2260f0ebc3d3b6043e09d3246edd92168cc36bc (patch) | |
tree | e594fe94756311dc506d8e15527d2812f5a8e78f /sys/kern/kern_physio.c | |
parent | d2544b2958464797324149b2ebe4df3e15bd80b9 (diff) |
from netbsd: check user access rights only if UIO_USERSPACE
Diffstat (limited to 'sys/kern/kern_physio.c')
-rw-r--r-- | sys/kern/kern_physio.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c index 4e02351d3f0..4b3a7addfcc 100644 --- a/sys/kern/kern_physio.c +++ b/sys/kern/kern_physio.c @@ -1,5 +1,5 @@ -/* $OpenBSD: kern_physio.c,v 1.2 1996/03/03 17:19:50 niklas Exp $ */ -/* $NetBSD: kern_physio.c,v 1.26 1996/02/04 02:15:51 christos Exp $ */ +/* $OpenBSD: kern_physio.c,v 1.3 1997/07/25 02:44:22 mickey Exp $ */ +/* $NetBSD: kern_physio.c,v 1.28 1997/05/19 10:43:28 pk Exp $ */ /*- * Copyright (c) 1994 Christopher G. Demetriou @@ -93,10 +93,12 @@ physio(strategy, bp, dev, flags, minphys, uio) * writing, so we ignore the uio's rw parameter. Also note that if * we're doing a read, that's a *write* to user-space. */ - for (i = 0; i < uio->uio_iovcnt; i++) - if (!useracc(uio->uio_iov[i].iov_base, uio->uio_iov[i].iov_len, - (flags == B_READ) ? B_WRITE : B_READ)) - return (EFAULT); + if (uio->uio_segflg == UIO_USERSPACE) + for (i = 0; i < uio->uio_iovcnt; i++) + if (!useracc(uio->uio_iov[i].iov_base, + uio->uio_iov[i].iov_len, + (flags == B_READ) ? B_WRITE : B_READ)) + return (EFAULT); /* Make sure we have a buffer, creating one if necessary. */ if ((nobuf = (bp == NULL)) != 0) |