mirror of
https://github.com/opnsense/src.git
synced 2026-06-06 23:32:52 -04:00
nfsd: Fix a server crash
PR#274346 reports a crash which appears to be caused by a NULL default session being destroyed. This patch should avoid the crash. Tested by: Joshua Kinard <freebsd@kumba.dev> PR: 274346 MFC after: 2 weeks
This commit is contained in:
parent
d2abbfede5
commit
db7257ef97
2 changed files with 13 additions and 2 deletions
|
|
@ -1208,6 +1208,14 @@ tryagain:
|
|||
NFSCL_DEBUG(1, "Got badsession\n");
|
||||
NFSLOCKCLSTATE();
|
||||
NFSLOCKMNT(nmp);
|
||||
if (TAILQ_EMPTY(&nmp->nm_sess)) {
|
||||
NFSUNLOCKMNT(nmp);
|
||||
NFSUNLOCKCLSTATE();
|
||||
printf("If server has not rebooted, "
|
||||
"check NFS clients for unique "
|
||||
"/etc/hostid's\n");
|
||||
goto out;
|
||||
}
|
||||
sep = NFSMNT_MDSSESSION(nmp);
|
||||
if (bcmp(sep->nfsess_sessionid, nd->nd_sequence,
|
||||
NFSX_V4SESSIONID) == 0) {
|
||||
|
|
@ -1388,6 +1396,7 @@ tryagain:
|
|||
nd->nd_repstat = NFSERR_STALEDONTRECOVER;
|
||||
}
|
||||
}
|
||||
out:
|
||||
|
||||
#ifdef KDTRACE_HOOKS
|
||||
if (nmp != NULL && dtrace_nfscl_nfs234_done_probe != NULL) {
|
||||
|
|
|
|||
|
|
@ -5141,11 +5141,13 @@ nfsrpc_destroysession(struct nfsmount *nmp, struct nfsclsession *tsep,
|
|||
struct nfsrv_descript *nd = &nfsd;
|
||||
int error;
|
||||
|
||||
if (tsep == NULL)
|
||||
tsep = nfsmnt_mdssession(nmp);
|
||||
if (tsep == NULL)
|
||||
return (0);
|
||||
nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0,
|
||||
0, NULL);
|
||||
NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID);
|
||||
if (tsep == NULL)
|
||||
tsep = nfsmnt_mdssession(nmp);
|
||||
bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID);
|
||||
nd->nd_flag |= ND_USEGSSNAME;
|
||||
error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
|
||||
|
|
|
|||
Loading…
Reference in a new issue