mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 06:42:45 +00:00
Fix a number of server-side issues related to aborting badly formed
NFS packets, mainly initializing structure pointers to NULL which are conditionally freed prior to return. PR: kern/15249 Submitted by: Ian Dowse <iedowse@maths.tcd.ie>
This commit is contained in:
parent
76df653e3d
commit
5f3bfd608d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54485
@ -1974,6 +1974,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (saddr->sin_family == AF_INET &&
|
||||
ntohs(saddr->sin_port) >= IPPORT_RESERVED) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
}
|
||||
@ -1984,10 +1985,12 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (exflags & MNT_EXKERB) {
|
||||
if (!kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
} else if (kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
} else if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) {
|
||||
cred->cr_uid = credanon->cr_uid;
|
||||
|
@ -769,8 +769,10 @@ nqnfsrv_getlease(nfsd, slp, procp, mrq)
|
||||
nfsd->nd_duration = fxdr_unsigned(int, *tl);
|
||||
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly,
|
||||
(nfsd->nd_flag & ND_KERBAUTH), TRUE);
|
||||
if (error)
|
||||
if (error) {
|
||||
nfsm_reply(0);
|
||||
goto nfsmout;
|
||||
}
|
||||
if (rdonly && flags == ND_WRITE) {
|
||||
error = EROFS;
|
||||
vput(vp);
|
||||
|
@ -249,7 +249,7 @@ nfsrv_getattr(nfsd, slp, procp, mrq)
|
||||
register struct nfs_fattr *fp;
|
||||
struct vattr va;
|
||||
register struct vattr *vap = &va;
|
||||
struct vnode *vp;
|
||||
struct vnode *vp = NULL;
|
||||
nfsfh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
register u_int32_t *tl;
|
||||
@ -453,7 +453,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
|
||||
struct ucred *cred = &nfsd->nd_cr;
|
||||
register struct nfs_fattr *fp;
|
||||
struct nameidata nd, ind, *ndp = &nd;
|
||||
struct vnode *vp, *dirp;
|
||||
struct vnode *vp, *dirp = NULL;
|
||||
nfsfh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
register caddr_t cp;
|
||||
@ -775,7 +775,7 @@ nfsrv_read(nfsd, slp, procp, mrq)
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq;
|
||||
struct mbuf *m2;
|
||||
struct vnode *vp;
|
||||
struct vnode *vp = NULL;
|
||||
nfsfh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
struct uio io, *uiop = &io;
|
||||
@ -1168,7 +1168,7 @@ nfsrv_writegather(ndp, slp, procp, mrq)
|
||||
int ioflags, aftat_ret = 1, s, adjust, v3, zeroing;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq, *mrep, *md;
|
||||
struct vnode *vp;
|
||||
struct vnode *vp = NULL;
|
||||
struct uio io, *uiop = &io;
|
||||
u_quad_t frev, cur_usec;
|
||||
|
||||
|
@ -1974,6 +1974,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (saddr->sin_family == AF_INET &&
|
||||
ntohs(saddr->sin_port) >= IPPORT_RESERVED) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
}
|
||||
@ -1984,10 +1985,12 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (exflags & MNT_EXKERB) {
|
||||
if (!kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
} else if (kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
} else if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) {
|
||||
cred->cr_uid = credanon->cr_uid;
|
||||
|
@ -1974,6 +1974,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (saddr->sin_family == AF_INET &&
|
||||
ntohs(saddr->sin_port) >= IPPORT_RESERVED) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
}
|
||||
@ -1984,10 +1985,12 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (exflags & MNT_EXKERB) {
|
||||
if (!kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
} else if (kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
} else if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) {
|
||||
cred->cr_uid = credanon->cr_uid;
|
||||
|
@ -249,7 +249,7 @@ nfsrv_getattr(nfsd, slp, procp, mrq)
|
||||
register struct nfs_fattr *fp;
|
||||
struct vattr va;
|
||||
register struct vattr *vap = &va;
|
||||
struct vnode *vp;
|
||||
struct vnode *vp = NULL;
|
||||
nfsfh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
register u_int32_t *tl;
|
||||
@ -453,7 +453,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
|
||||
struct ucred *cred = &nfsd->nd_cr;
|
||||
register struct nfs_fattr *fp;
|
||||
struct nameidata nd, ind, *ndp = &nd;
|
||||
struct vnode *vp, *dirp;
|
||||
struct vnode *vp, *dirp = NULL;
|
||||
nfsfh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
register caddr_t cp;
|
||||
@ -775,7 +775,7 @@ nfsrv_read(nfsd, slp, procp, mrq)
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq;
|
||||
struct mbuf *m2;
|
||||
struct vnode *vp;
|
||||
struct vnode *vp = NULL;
|
||||
nfsfh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
struct uio io, *uiop = &io;
|
||||
@ -1168,7 +1168,7 @@ nfsrv_writegather(ndp, slp, procp, mrq)
|
||||
int ioflags, aftat_ret = 1, s, adjust, v3, zeroing;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq, *mrep, *md;
|
||||
struct vnode *vp;
|
||||
struct vnode *vp = NULL;
|
||||
struct uio io, *uiop = &io;
|
||||
u_quad_t frev, cur_usec;
|
||||
|
||||
|
@ -1974,6 +1974,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (saddr->sin_family == AF_INET &&
|
||||
ntohs(saddr->sin_port) >= IPPORT_RESERVED) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
}
|
||||
@ -1984,10 +1985,12 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
|
||||
if (exflags & MNT_EXKERB) {
|
||||
if (!kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
}
|
||||
} else if (kerbflag) {
|
||||
vput(*vpp);
|
||||
*vpp = NULL;
|
||||
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
|
||||
} else if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) {
|
||||
cred->cr_uid = credanon->cr_uid;
|
||||
|
Loading…
Reference in New Issue
Block a user