diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2009-07-30 14:04:29 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2009-07-30 14:04:29 +0000 |
commit | ace0f2fb19ea2ef51691f1edcc534bf85f27a736 (patch) | |
tree | 25442d8ff4b713036d37f26d9a4337544b63e0a8 | |
parent | a4a0375c140fd7522a48e4b1809f29dca5224051 (diff) |
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.c | 12 | ||||
-rw-r--r-- | sys/nfs/nfsm_subs.h | 10 |
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); \ |