rx: rxi_FindRpcStat must test for empty queue
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 23 Jul 2012 00:40:41 +0000 (20:40 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Mon, 23 Jul 2012 14:54:11 +0000 (07:54 -0700)
When queue_Scan is executed on an empty queue the queue element
variable, in this case 'rpc_stat' is the queue head, _RXQ(q),
and not NULL.  Callers of rxi_FindRpcStat() expect NULL on failure
to find or create an rx_interface_stat object.  Correct the behavior
by testing for an empty queue and return NULL immediately if the
queue is empty and the caller is not requesting creation.

Change-Id: I9952d7aaf357e039e87f6b8b17cb1a00208d6465
Reviewed-on: http://gerrit.openafs.org/7835
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/rx/rx.c

index 81dff70..0f30eb6 100644 (file)
@@ -8110,6 +8110,10 @@ rxi_FindRpcStat(struct rx_queue *stats, afs_uint32 rxInterface,
                unsigned int *counter, int create)
 {
     rx_interface_stat_p rpc_stat, nrpc_stat;
+
+    if (queue_IsEmpty(stats) && !create)
+        return NULL;
+
     /*
      * See if there's already a structure for this interface
      */