Source-Changes-HG archive

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

[src/netbsd-3-0]: src/sys/kern Pull up following revision(s) (requested by wr...



details:   https://anonhg.NetBSD.org/src/rev/fe1ff992786b
branches:  netbsd-3-0
changeset: 579388:fe1ff992786b
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Mar 03 22:55:53 2007 +0000

description:
Pull up following revision(s) (requested by wrstuden in ticket #1616):
        sys/kern/vfs_syscalls.c: revision 1.293 via patch
Fix issue noted by Ilja van Sprundel and disclosed at 23C3.
Make sure we always FILE_UNUSE the file. To make it easier, exit
via a new "out:" exit path that does so, setting error beforehand.
Fix suggested by Elad, hand-typed by me.

diffstat:

 sys/kern/vfs_syscalls.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 0d9d29843048 -r fe1ff992786b sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Mon Feb 19 22:22:26 2007 +0000
+++ b/sys/kern/vfs_syscalls.c   Sat Mar 03 22:55:53 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.217.2.7 2005/09/08 21:06:31 tron Exp $      */
+/*     $NetBSD: vfs_syscalls.c,v 1.217.2.7.2.1 2007/03/03 22:55:53 bouyer Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.217.2.7 2005/09/08 21:06:31 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.217.2.7.2.1 2007/03/03 22:55:53 bouyer Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_43.h"
@@ -3093,14 +3093,15 @@
                return (error);
 
        if ((fp->f_flag & FWRITE) == 0) {
-               FILE_UNUSE(fp, p);
-               return (EBADF);
+               error = EBADF;
+               goto out;
        }
 
        flags = SCARG(uap, flags);
        if (((flags & (FDATASYNC | FFILESYNC)) == 0) ||
            ((~flags & (FDATASYNC | FFILESYNC)) == 0)) {
-               return (EINVAL);
+               error = EINVAL;
+               goto out;
        }
        /* Now set up the flags for value(s) to pass to VOP_FSYNC() */
        if (flags & FDATASYNC)
@@ -3117,7 +3118,8 @@
                e = s + len;
                if (e < s) {
                        FILE_UNUSE(fp, p);
-                       return (EINVAL);
+                       error = EINVAL;
+                       goto out;
                }
        } else {
                e = 0;
@@ -3133,6 +3135,7 @@
                (*bioops.io_fsync)(vp, nflags);
 
        VOP_UNLOCK(vp, 0);
+out:
        FILE_UNUSE(fp, p);
        return (error);
 }



Home | Main Index | Thread Index | Old Index