Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs Fix PR8270:



details:   https://anonhg.NetBSD.org/src/rev/1d7c90e00884
branches:  trunk
changeset: 475743:1d7c90e00884
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Tue Aug 24 23:29:08 1999 +0000

description:
Fix PR8270:

Problem turned out to be due to improper handling of reads beyond EOF:
they should just return without error with the uio unchanged, and the
caller will recognize this as a zero-byte return (EOF).

The previous fix to protect directory reads against bogus uio_offset
values returned EINVAL, which broke mount -o union, which only
union'ed in the lower directory if the upper directory cleanly
returned EOF.

While we're here, protect kernfs as well.

diffstat:

 sys/miscfs/fdesc/fdesc_vnops.c   |  4 ++--
 sys/miscfs/kernfs/kernfs_vnops.c |  6 +++++-
 sys/miscfs/procfs/procfs_vnops.c |  4 ++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diffs (56 lines):

diff -r 13bfd42c0e66 -r 1d7c90e00884 sys/miscfs/fdesc/fdesc_vnops.c
--- a/sys/miscfs/fdesc/fdesc_vnops.c    Tue Aug 24 23:17:46 1999 +0000
+++ b/sys/miscfs/fdesc/fdesc_vnops.c    Tue Aug 24 23:29:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdesc_vnops.c,v 1.51 1999/08/14 02:17:17 christos Exp $        */
+/*     $NetBSD: fdesc_vnops.c,v 1.52 1999/08/24 23:29:08 sommerfeld Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -712,7 +712,7 @@
                struct fdesc_target *ft;
 
                if (i >= nfdesc_targets)
-                       return EINVAL;
+                       return 0;
 
                if (ap->a_ncookies) {
                        ncookies = min(ncookies, (nfdesc_targets - i));
diff -r 13bfd42c0e66 -r 1d7c90e00884 sys/miscfs/kernfs/kernfs_vnops.c
--- a/sys/miscfs/kernfs/kernfs_vnops.c  Tue Aug 24 23:17:46 1999 +0000
+++ b/sys/miscfs/kernfs/kernfs_vnops.c  Tue Aug 24 23:29:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_vnops.c,v 1.65 1999/08/03 20:19:19 wrstuden Exp $       */
+/*     $NetBSD: kernfs_vnops.c,v 1.66 1999/08/24 23:29:09 sommerfeld Exp $     */
 
 /*
  * Copyright (c) 1992, 1993
@@ -626,6 +626,10 @@
 
        error = 0;
        i = uio->uio_offset;
+
+       if (i >= nkern_targets)
+               return 0;
+         
        memset((caddr_t)&d, 0, UIO_MX);
        d.d_reclen = UIO_MX;
 
diff -r 13bfd42c0e66 -r 1d7c90e00884 sys/miscfs/procfs/procfs_vnops.c
--- a/sys/miscfs/procfs/procfs_vnops.c  Tue Aug 24 23:17:46 1999 +0000
+++ b/sys/miscfs/procfs/procfs_vnops.c  Tue Aug 24 23:29:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_vnops.c,v 1.66 1999/08/14 02:20:19 christos Exp $       */
+/*     $NetBSD: procfs_vnops.c,v 1.67 1999/08/24 23:29:09 sommerfeld Exp $     */
 
 /*
  * Copyright (c) 1993 Jan-Simon Pendry
@@ -876,7 +876,7 @@
                struct proc_target *pt;
 
                if (i >= nproc_targets)
-                       return EINVAL;
+                       return 0;
 
                p = PFIND(pfs->pfs_pid);
                if (p == NULL)



Home | Main Index | Thread Index | Old Index