Source-Changes-HG archive

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

[src/netbsd-2]: src/sys/kern Pull up following revision(s) (requested by adri...



details:   https://anonhg.NetBSD.org/src/rev/0bd9bd603cc3
branches:  netbsd-2
changeset: 564576:0bd9bd603cc3
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Feb 06 21:15:55 2007 +0000

description:
Pull up following revision(s) (requested by adrianp in ticket #11015):
        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 d4713fd74ecf -r 0bd9bd603cc3 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Mon Jan 29 22:44:36 2007 +0000
+++ b/sys/kern/vfs_syscalls.c   Tue Feb 06 21:15:55 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.205 2004/03/23 13:22:33 junyoung Exp $      */
+/*     $NetBSD: vfs_syscalls.c,v 1.205.4.1 2007/02/06 21:15:55 bouyer Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.205 2004/03/23 13:22:33 junyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.205.4.1 2007/02/06 21:15:55 bouyer Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_43.h"
@@ -3045,14 +3045,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)
@@ -3067,7 +3068,8 @@
                e = s + len;
                if (e < s) {
                        FILE_UNUSE(fp, p);
-                       return (EINVAL);
+                       error = EINVAL;
+                       goto out;
                }
        } else {
                e = 0;
@@ -3083,6 +3085,7 @@
                (*bioops.io_fsync)(vp);
 
        VOP_UNLOCK(vp, 0);
+out:
        FILE_UNUSE(fp, p);
        return (error);
 }



Home | Main Index | Thread Index | Old Index