summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-03-21 16:33:22 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-03-21 16:33:22 +0000
commit6c568936f19073ed10256f01af630dbb31c80cbe (patch)
tree14de9a3929df4f1e5467a90815c9dd73899780fe /sys
parent66b3f8db630a38fd7fbd0bad090499ba0a25a2de (diff)
Prevent vrele() being called with a NULL argument if nfs_namei() returns an
error in several places. Should fix the "vrele: null vp" panic that henning@ has been seeing lately. ok tedu@, krw@, deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs_serv.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 0472ab8adfe..73de3b3590c 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_serv.c,v 1.91 2010/09/09 10:37:04 thib Exp $ */
+/* $OpenBSD: nfs_serv.c,v 1.92 2012/03/21 16:33:21 kettenis Exp $ */
/* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */
/*
@@ -897,7 +897,7 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
nfsm_reply(NFSX_WCCDATA(info.nmi_v3));
nfsm_srvwcc(nfsd, dirfor_ret, &dirfor, diraft_ret, &diraft,
&info);
- if (info.nmi_v3)
+ if (dirp)
vrele(dirp);
return (0);
}
@@ -1134,7 +1134,8 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
nfsm_reply(NFSX_WCCDATA(1));
nfsm_srvwcc(nfsd, dirfor_ret, &dirfor, diraft_ret, &diraft,
&info);
- vrele(dirp);
+ if (dirp)
+ vrele(dirp);
return (0);
}
@@ -1387,7 +1388,7 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
&info);
nfsm_srvwcc(nfsd, tdirfor_ret, &tdirfor, tdiraft_ret, &tdiraft,
&info);
- if (info.nmi_v3)
+ if (fdirp)
vrele(fdirp);
return (0);
}
@@ -1811,7 +1812,7 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
nfsm_reply(NFSX_WCCDATA(info.nmi_v3));
nfsm_srvwcc(nfsd, dirfor_ret, &dirfor, diraft_ret, &diraft,
&info);
- if (info.nmi_v3)
+ if (dirp)
vrele(dirp);
return (0);
}
@@ -1928,7 +1929,7 @@ nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
nfsm_reply(NFSX_WCCDATA(info.nmi_v3));
nfsm_srvwcc(nfsd, dirfor_ret, &dirfor, diraft_ret, &diraft,
&info);
- if (info.nmi_v3)
+ if (dirp)
vrele(dirp);
return (0);
}