From a44757e31c2ba16efc28561228981a0eda433146 Mon Sep 17 00:00:00 2001 From: Ion Badulescu Date: Wed, 4 Sep 2002 20:18:34 +0000 Subject: [PATCH] * amd/mntfs.c (free_mntfs): sanity check for mf_refc [patch from George Ross ported from 6.1] --- ChangeLog | 3 +++ amd/mntfs.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3946b5b..4e3e7de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2002-09-04 Ion Badulescu + * amd/mntfs.c (free_mntfs): sanity check for mf_refc [patch from + George Ross ported from 6.1] + * amd/srvr_nfs.c (nfs_timed_out): allocate a new XID on server timeout to avoid problems with late ping replies [patch from George Ross ported from 6.1] diff --git a/amd/mntfs.c b/amd/mntfs.c index 8bdc381..80dca56 100644 --- a/amd/mntfs.c +++ b/amd/mntfs.c @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: mntfs.c,v 1.5.2.2 2002/01/21 00:49:39 ezk Exp $ + * $Id: mntfs.c,v 1.5.2.3 2002/09/04 20:18:35 ib42 Exp $ * */ @@ -264,6 +264,17 @@ free_mntfs(voidp v) { mntfs *mf = v; + /* + * We shouldn't ever be called to free something that has + * a non-positive refcount. Something is badly wrong if + * we have been! Ignore the request for now... + */ + if(mf->mf_refc <= 0) { + plog(XLOG_ERROR, "IGNORING free_mntfs for <%s>: refc %d, flags %x", + mf->mf_mount, mf->mf_refc, mf->mf_flags); + return; + } + if (--mf->mf_refc == 0) { if (mf->mf_flags & MFF_MOUNTED) { int quoted; -- 2.43.0