]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Panic on afs_conn refcount imbalance
authorAndrew Deason <adeason@sinenomine.net>
Thu, 22 Dec 2011 20:48:49 +0000 (15:48 -0500)
committerDerrick Brashear <shadow@dementix.org>
Tue, 7 Feb 2012 14:39:06 +0000 (06:39 -0800)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 8a574ba16a80fc2b8b703ddcfc99486b977e6071)

Change-Id: Ibd60dafdf1a800349b73754dae18666fa0edd300
Reviewed-on: http://gerrit.openafs.org/6642
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/afs/afs_conn.c

index cbe1fcbaf3937fdfa192644c30320a0b825be2e2..95baf6c4a13f7f9c23e82f1cf2470be12b30cbec 100644 (file)
@@ -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 */