DAFS: Avoid volserver segfault in GetVolInfo
authorAndrew Deason <adeason@sinenomine.net>
Wed, 30 Sep 2009 21:42:46 +0000 (16:42 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Wed, 30 Sep 2009 22:08:12 +0000 (15:08 -0700)
It is possible for GetVolObject to return success, but result in a NULL
fs_tv. In particular, when the fileserver responds with FSYNC_WRONG_PART
or FSYNC_UNKNOWN_VOLID. It is possible, though difficult, for the
fileserver to respond with FSYNC_UNKNOWN_VOLID if the requested volume
hasn't been preattached on the fileserver yet.

So, in GetVolInfo, also check fs_tv, so we don't try to dereference it
later.

Reviewed-on: http://gerrit.openafs.org/562
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/volser/volprocs.c

index 3f35ca9..4e6b588 100644 (file)
@@ -2155,7 +2155,8 @@ GetVolInfo(afs_uint32 partId,
 
 #ifdef AFS_DEMAND_ATTACH_FS
     /* If using DAFS, get volume from fsserver */
-    if (GetVolObject(volumeId, pname, &fs_tv) != SYNC_OK) {
+    if (GetVolObject(volumeId, pname, &fs_tv) != SYNC_OK || fs_tv == NULL) {
+
        goto drop;
     }