windows-afsd-findserverbyip-refcount-20081223
authorMatt Benjamin <matt@linuxbox.com>
Tue, 23 Dec 2008 20:42:38 +0000 (20:42 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 23 Dec 2008 20:42:38 +0000 (20:42 +0000)
LICENSE BSD
FIXES 124054

reference count the server object returned by cm_FindServerByIP

src/WINNT/afsd/cm_callback.c
src/WINNT/afsd/cm_server.c

index 1ce5b00..df3a015 100644 (file)
@@ -357,8 +357,10 @@ SRXAFSCB_CallBack(struct rx_call *callp, AFSCBFids *fidsArrayp, AFSCBs *cbsArray
         port = rx_PortOf(peerp);
 
         tsp = cm_FindServerByIP(host, CM_SERVER_FILE);
-        if (tsp)
+        if (tsp) {
             cellp = tsp->cellp;
+            cm_PutServer(tsp);
+        }
 
         if (!cellp)
             osi_Log2(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d",
index a2748d5..7567d61 100644 (file)
@@ -926,6 +926,11 @@ cm_FindServerByIP(afs_uint32 ipaddr, int type)
             tsp->addr.sin_addr.S_un.S_addr == ipaddr)
             break;
     }
+
+    /* bump ref count if we found the server */
+    if (tsp) 
+        cm_GetServerNoLock(tsp);
+
     lock_ReleaseRead(&cm_serverLock);
 
     return tsp;