Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/nfs Pull up revision 1.65 (requested by bouyer in t...



details:   https://anonhg.NetBSD.org/src/rev/d138077e2568
branches:  netbsd-1-6
changeset: 529119:d138077e2568
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Sep 30 13:52:26 2002 +0000

description:
Pull up revision 1.65 (requested by bouyer in ticket #880):
In nfs_commit(), sanity-check what we get from network: if we try to fluch
past end of file, or if off + cnt overflows a quad_t, flush to end of file.

diffstat:

 sys/nfs/nfs_serv.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 6aad8dfcc34d -r d138077e2568 sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c        Mon Sep 30 13:49:53 2002 +0000
+++ b/sys/nfs/nfs_serv.c        Mon Sep 30 13:52:26 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_serv.c,v 1.62.10.2 2002/09/30 13:49:53 lukem Exp $ */
+/*     $NetBSD: nfs_serv.c,v 1.62.10.3 2002/09/30 13:52:26 lukem Exp $ */
 
 /*
  * Copyright (c) 1989, 1993
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.62.10.2 2002/09/30 13:49:53 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.62.10.3 2002/09/30 13:52:26 lukem Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2989,7 +2989,7 @@
        int error = 0, rdonly, for_ret = 1, aft_ret = 1, cnt, cache;
        char *cp2;
        struct mbuf *mb, *mb2, *mreq;
-       u_quad_t frev, off;
+       u_quad_t frev, off, end;
 
 #ifndef nolint
        cache = 0;
@@ -3009,10 +3009,10 @@
                return (0);
        }
        for_ret = VOP_GETATTR(vp, &bfor, cred, procp);
-       if (cnt > 0)
-               error = VOP_FSYNC(vp, cred, FSYNC_WAIT, off, off + cnt, procp);
-       else
-               error = VOP_FSYNC(vp, cred, FSYNC_WAIT, off, vp->v_size, procp);
+       end = (cnt > 0) ? off + cnt : vp->v_size;
+       if (end < off || end > vp->v_size)
+               end = vp->v_size;
+       error = VOP_FSYNC(vp, cred, FSYNC_WAIT, off, end, procp);
        aft_ret = VOP_GETATTR(vp, &aft, cred, procp);
        vput(vp);
        nfsm_reply(NFSX_V3WCCDATA + NFSX_V3WRITEVERF);



Home | Main Index | Thread Index | Old Index