From: Andrew Deason Date: Thu, 22 Dec 2011 20:48:49 +0000 (-0500) Subject: afs: Panic on afs_conn refcount imbalance X-Git-Tag: upstream/1.6.1.pre4^2~76 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f0e648bfa30958f47f1e7bbe656ebe0f4556a52a;p=packages%2Fo%2Fopenafs.git afs: Panic on afs_conn refcount imbalance An undercounted afs_conn can easily cause a panic and/or memory corruption later on, since we put an rx_connection reference with each afs_conn reference. Panic as soon as we detect this, as this indicates a serious bug. Reviewed-on: http://gerrit.openafs.org/6413 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 8a574ba16a80fc2b8b703ddcfc99486b977e6071) Change-Id: Ibd60dafdf1a800349b73754dae18666fa0edd300 Reviewed-on: http://gerrit.openafs.org/6642 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/afs_conn.c b/src/afs/afs_conn.c index cbe1fcbaf..95baf6c4a 100644 --- a/src/afs/afs_conn.c +++ b/src/afs/afs_conn.c @@ -479,6 +479,10 @@ afs_PutConn(struct afs_conn *ac, struct rx_connection *rxconn, { AFS_STATCNT(afs_PutConn); ac->refCount--; + if (ac->refCount < 0) { + osi_Panic("afs_PutConn: refcount imbalance 0x%lx %d", + (unsigned long)(uintptrsz)ac, (int)ac->refCount); + } rx_PutConnection(rxconn); } /*afs_PutConn */