dafs: avoid null deref getting volume header
authorDerrick Brashear <shadow@dementix.org>
Sun, 6 Nov 2011 21:28:27 +0000 (16:28 -0500)
committerDerrick Brashear <shadow@dementix.org>
Mon, 7 Nov 2011 16:47:23 +0000 (08:47 -0800)
we don't assign hd before dereferencing. stop dereferencing
and just use the queue cursor.

Change-Id: I023fd959c5d49575dbdf89fd4dab77341c5c52d0
Reviewed-on: http://gerrit.openafs.org/5814
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/vol/volume.c

index 287041e..319aeab 100644 (file)
@@ -7929,7 +7929,7 @@ GetVolHeaderFromLRU(void)
      * could VWaitExclusiveState_r instead, but not waiting is faster and
      * easier to do */
     for (queue_Scan(&volume_hdr_LRU, qh, nqh, volHeader)) {
-       if (!hd->back || !VIsExclusiveState(V_attachState(hd->back))) {
+       if (!qh->back || !VIsExclusiveState(V_attachState(qh->back))) {
            queue_Remove(qh);
            hd = qh;
            break;