summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthib <thib@openbsd.org>2009-07-30 14:04:28 +0000
committerthib <thib@openbsd.org>2009-07-30 14:04:28 +0000
commit87ff17a3054e80603bf298ae67291c06a0d3c742 (patch)
tree9e299d25a509b5191f3ce4d2d5b5bf842d76892c
parentMerge pane number into the target specification for pane commands. Instead of (diff)
downloadwireguard-openbsd-87ff17a3054e80603bf298ae67291c06a0d3c742.tar.xz
wireguard-openbsd-87ff17a3054e80603bf298ae67291c06a0d3c742.zip
make sure we only ever try to read out post-op attributes
or wcc data if we have a proper reply. found the hard way by ariane@, tested by ariane@. OK blambert@
-rw-r--r--sys/nfs/nfs_socket.c12
-rw-r--r--sys/nfs/nfsm_subs.h10
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index b43ff3d575e..aed2d7aa00e 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.91 2009/07/22 13:04:56 blambert Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.92 2009/07/30 14:04:28 thib Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -994,8 +994,10 @@ tryagain:
mrep = rep->r_mrep;
md = rep->r_md;
dpos = rep->r_dpos;
- if (error)
- goto nfsmout;
+ if (error) {
+ *mrp = NULL;
+ goto nfsmout1;
+ }
/*
* break down the rpc header and check if ok
@@ -1006,7 +1008,8 @@ tryagain:
error = EOPNOTSUPP;
else
error = EACCES; /* Should be EAUTH. */
- goto nfsmout;
+ *mrp = NULL;
+ goto nfsmout1;
}
/*
@@ -1055,6 +1058,7 @@ nfsmout:
*mrp = mrep;
*mdp = md;
*dposp = dpos;
+nfsmout1:
m_freem(rep->r_mreq);
pool_put(&nfsreqpl, rep);
return (error);
diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h
index 44dfe2e0ec2..e278ad676cd 100644
--- a/sys/nfs/nfsm_subs.h
+++ b/sys/nfs/nfsm_subs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsm_subs.h,v 1.39 2009/07/20 16:49:40 thib Exp $ */
+/* $OpenBSD: nfsm_subs.h,v 1.40 2009/07/30 14:04:28 thib Exp $ */
/* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */
/*
@@ -141,7 +141,7 @@
(v) = ttvp; \
}
-#define nfsm_postop_attr(v, f) { \
+#define nfsm_postop_attr(v, f) { if (mrep != NULL) { \
struct vnode *ttvp = (v); \
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
if (((f) = fxdr_unsigned(int, *tl)) != 0) { \
@@ -154,13 +154,13 @@
} \
(v) = ttvp; \
} \
-}
+} }
/* Used as (f) for nfsm_wcc_data() */
#define NFSV3_WCCRATTR 0
#define NFSV3_WCCCHK 1
-#define nfsm_wcc_data(v, f) do { \
+#define nfsm_wcc_data(v, f) do { if (mrep != NULL) { \
struct timespec _mtime; \
int ttattrf, ttretf = 0; \
\
@@ -179,7 +179,7 @@
} else { \
(f) = ttattrf; \
} \
-} while (0)
+} } while (0)
#define nfsm_strsiz(s,m) { \
nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \