be2net: Fix be_tx_q_clean() being called on freed queues
authorSathya Perla <sathyap@serverengines.com>
Wed, 10 Jun 2009 02:23:50 +0000 (02:23 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Jun 2009 09:47:19 +0000 (02:47 -0700)
In the tx queue destroy path, be_tx_q_clean() is currently called after the tx queues are freed; it must be called before.

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/benet/be_main.c

index 86f70af93d605432dda7d77e57da7dc3cbd6ba6c..66bb56874d9bd0bbc99b18284f836f2e6a2535ba 100644 (file)
@@ -1056,8 +1056,13 @@ static void be_tx_queues_destroy(struct be_adapter *adapter)
        struct be_queue_info *q;
 
        q = &adapter->tx_obj.q;
-       if (q->created)
+       if (q->created) {
                be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_TXQ);
+
+               /* No more tx completions can be rcvd now; clean up if there
+                * are any pending completions or pending tx requests */
+               be_tx_q_clean(adapter);
+       }
        be_queue_free(adapter, q);
 
        q = &adapter->tx_obj.cq;
@@ -1065,10 +1070,6 @@ static void be_tx_queues_destroy(struct be_adapter *adapter)
                be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_CQ);
        be_queue_free(adapter, q);
 
-       /* No more tx completions can be rcvd now; clean up if there are
-        * any pending completions or pending tx requests */
-       be_tx_q_clean(adapter);
-
        q = &adapter->tx_eq.q;
        if (q->created)
                be_cmd_q_destroy(&adapter->ctrl, q, QTYPE_EQ);