Module Name: src
Committed By: hannken
Date: Thu May 3 07:28:44 UTC 2018
Modified Files:
src/sys/nfs: nfs_serv.c
Log Message:
nfsrv_readlink: stop attaching a zero-length mbuf for zero length symlinks.
To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/nfs/nfs_serv.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_serv.c
diff -u src/sys/nfs/nfs_serv.c:1.173 src/sys/nfs/nfs_serv.c:1.174
--- src/sys/nfs/nfs_serv.c:1.173 Wed Apr 26 03:02:49 2017
+++ src/sys/nfs/nfs_serv.c Thu May 3 07:28:43 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_serv.c,v 1.173 2017/04/26 03:02:49 riastradh Exp $ */
+/* $NetBSD: nfs_serv.c,v 1.174 2018/05/03 07:28:43 hannken Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.173 2017/04/26 03:02:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.174 2018/05/03 07:28:43 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -600,7 +600,10 @@ out:
}
len -= uiop->uio_resid;
padlen = nfsm_padlen(len);
- if (uiop->uio_resid || padlen)
+ if (len == 0) {
+ m_freem(mp3);
+ mp3 = NULL;
+ } else if (uiop->uio_resid || padlen)
nfs_zeropad(mp3, uiop->uio_resid, padlen);
nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
*tl = txdr_unsigned(len);