Module Name:    src
Committed By:   hannken
Date:           Tue Dec 20 09:40:09 UTC 2022

Modified Files:
        src/sys/nfs: nfs_srvsocket.c

Log Message:
When partitioning a mbuf chain with m_split() the last mbuf of the returned
tail chain is not necessarily the same as the last mbuf of the initial chain.

Always set "slp->ns_rawend" to the last mbuf of the tail chain to prevent
mbuf leaks and corruption.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/nfs/nfs_srvsocket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/nfs/nfs_srvsocket.c
diff -u src/sys/nfs/nfs_srvsocket.c:1.4 src/sys/nfs/nfs_srvsocket.c:1.5
--- src/sys/nfs/nfs_srvsocket.c:1.4	Thu Sep  3 20:59:12 2009
+++ src/sys/nfs/nfs_srvsocket.c	Tue Dec 20 09:40:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_srvsocket.c,v 1.4 2009/09/03 20:59:12 tls Exp $	*/
+/*	$NetBSD: nfs_srvsocket.c,v 1.5 2022/12/20 09:40:09 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_srvsocket.c,v 1.4 2009/09/03 20:59:12 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_srvsocket.c,v 1.5 2022/12/20 09:40:09 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -323,8 +323,9 @@ nfsrv_getstream(struct nfssvc_sock *slp,
 			}
 			m_claimm(recm, &nfs_mowner);
 			slp->ns_raw = m;
-			if (m->m_next == NULL)
-				slp->ns_rawend = m;
+			while (m->m_next)
+				m = m->m_next;
+			slp->ns_rawend = m;
 			slp->ns_cc -= slp->ns_reclen;
 			slp->ns_reclen = 0;
 		} else {

Reply via email to