Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs Fix mbuf leak in nfssvc_nfsd().



details:   https://anonhg.NetBSD.org/src/rev/26e9922794bd
branches:  trunk
changeset: 583374:26e9922794bd
user:      onoe <onoe%NetBSD.org@localhost>
date:      Wed Aug 03 06:25:11 2005 +0000

description:
Fix mbuf leak in nfssvc_nfsd().

diffstat:

 sys/nfs/nfs_syscalls.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r c24a5c013398 -r 26e9922794bd sys/nfs/nfs_syscalls.c
--- a/sys/nfs/nfs_syscalls.c    Tue Aug 02 18:54:53 2005 +0000
+++ b/sys/nfs/nfs_syscalls.c    Wed Aug 03 06:25:11 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_syscalls.c,v 1.79 2005/07/07 02:05:03 christos Exp $       */
+/*     $NetBSD: nfs_syscalls.c,v 1.80 2005/08/03 06:25:11 onoe Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.79 2005/07/07 02:05:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.80 2005/08/03 06:25:11 onoe Exp $");
 
 #include "fs_nfs.h"
 #include "opt_nfs.h"
@@ -693,6 +693,7 @@
                                 */
                                lockcount = l->l_locks;
 #endif
+                               mreq = NULL;
                                if (writes_todo || (!(nd->nd_flag & ND_NFSV3) &&
                                     nd->nd_procnum == NFSPROC_WRITE &&
                                     nfsrvw_procrastinate > 0 && !notstarted))
@@ -721,8 +722,15 @@
                                            lockcount, l->l_locks);
                                }
 #endif
-                               if (mreq == NULL)
+                               if (mreq == NULL) {
+                                       if (nd != NULL) {
+                                               if (nd->nd_nam2)
+                                                       m_free(nd->nd_nam2);
+                                               if (nd->nd_mrep)
+                                                       m_freem(nd->nd_mrep);
+                                       }
                                        break;
+                               }
                                if (error) {
                                        if (nd->nd_procnum != NQNFSPROC_VACATED)
                                                nfsstats.srv_errs++;



Home | Main Index | Thread Index | Old Index