cm fetchstore should dereference unset ops
authorDerrick Brashear <shadow@dementia.org>
Sun, 13 Sep 2009 05:00:45 +0000 (01:00 -0400)
committerDerrick Brashear <shadow|account-1000005@unknown>
Sun, 13 Sep 2009 05:05:29 +0000 (22:05 -0700)
if rxfs_fetchInit fails, ops will not be set; calling the destroy op
unconditionally thus leads to a panic.

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

src/afs/afs_fetchstore.c

index cd2a4b5..6f2f354 100644 (file)
@@ -529,7 +529,8 @@ afs_CacheStoreDCaches(struct vcache *avc, struct dcache **dclist,
        }
        XSTATS_END_TIME;
     }
-    code = (*ops->destroy)(&rock, code);
+    if (ops)
+       code = (*ops->destroy)(&rock, code);
     return code;
 }
 
@@ -1129,7 +1130,8 @@ afs_CacheFetchProc(struct afs_conn *tc, struct osi_file *fP, afs_size_t base,
     } while (moredata);
     if (!code)
        code = (*ops->close)(rock, avc, adc, tsmall);
-    (*ops->destroy)(&rock, code);
+    if (ops)
+       (*ops->destroy)(&rock, code);
 
 #ifndef AFS_NOSTATS
     FillStoreStats(code, AFS_STATS_FS_XFERIDX_FETCHDATA, &xferStartTime,