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.
This commit is contained in:
parent
0eb52fcc16
commit
2e649e46d3
|
@ -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 @@ fdesc_readdir(v)
|
|||
struct fdesc_target *ft;
|
||||
|
||||
if (i >= nfdesc_targets)
|
||||
return EINVAL;
|
||||
return 0;
|
||||
|
||||
if (ap->a_ncookies) {
|
||||
ncookies = min(ncookies, (nfdesc_targets - i));
|
||||
|
|
|
@ -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 @@ kernfs_readdir(v)
|
|||
|
||||
error = 0;
|
||||
i = uio->uio_offset;
|
||||
|
||||
if (i >= nkern_targets)
|
||||
return 0;
|
||||
|
||||
memset((caddr_t)&d, 0, UIO_MX);
|
||||
d.d_reclen = UIO_MX;
|
||||
|
||||
|
|
|
@ -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 @@ procfs_readdir(v)
|
|||
struct proc_target *pt;
|
||||
|
||||
if (i >= nproc_targets)
|
||||
return EINVAL;
|
||||
return 0;
|
||||
|
||||
p = PFIND(pfs->pfs_pid);
|
||||
if (p == NULL)
|
||||
|
|
Loading…
Reference in New Issue