Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs nfs: Avoid free of uninitialized on bad name size in...



details:   https://anonhg.NetBSD.org/src/rev/fa56393ce461
branches:  trunk
changeset: 374004:fa56393ce461
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 23 19:53:01 2023 +0000

description:
nfs: Avoid free of uninitialized on bad name size in create, mknod.

XXX These error branches are a nightmare and need to be more
systematically cleaned up.  Even if they are correct now, they are
impossible to audit and extremely fragile in case anyone ever needs
to make other changes to them.

XXX pullup-8
XXX pullup-9
XXX pullup-10

diffstat:

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

diffs (48 lines):

diff -r 32c0297631e9 -r fa56393ce461 sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c        Thu Mar 23 19:52:52 2023 +0000
+++ b/sys/nfs/nfs_serv.c        Thu Mar 23 19:53:01 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_serv.c,v 1.183 2022/04/27 17:38:52 hannken Exp $   */
+/*     $NetBSD: nfs_serv.c,v 1.184 2023/03/23 19:53:01 riastradh Exp $ */
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.183 2022/04/27 17:38:52 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.184 2023/03/23 19:53:01 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1648,10 +1648,10 @@ nfsmout:
                        vput(nd.ni_dvp);
                if (nd.ni_vp)
                        vput(nd.ni_vp);
-       }
-       if (nd.ni_pathbuf != NULL) {
-               pathbuf_destroy(nd.ni_pathbuf);
-               nd.ni_pathbuf = NULL;
+               if (nd.ni_pathbuf != NULL) {
+                       pathbuf_destroy(nd.ni_pathbuf);
+                       nd.ni_pathbuf = NULL;
+               }
        }
        return (error);
 }
@@ -1801,10 +1801,10 @@ nfsmout:
                        vput(nd.ni_dvp);
                if (nd.ni_vp)
                        vput(nd.ni_vp);
-       }
-       if (nd.ni_pathbuf != NULL) {
-               pathbuf_destroy(nd.ni_pathbuf);
-               nd.ni_pathbuf = NULL;
+               if (nd.ni_pathbuf != NULL) {
+                       pathbuf_destroy(nd.ni_pathbuf);
+                       nd.ni_pathbuf = NULL;
+               }
        }
        if (dirp)
                vrele(dirp);



Home | Main Index | Thread Index | Old Index