]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ibmvnic: initialize rc before completing wait
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Fri, 25 Feb 2022 06:23:52 +0000 (22:23 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Feb 2022 10:57:47 +0000 (10:57 +0000)
We should initialize ->init_done_rc before calling complete(). Otherwise
the waiting thread may see ->init_done_rc as 0 before we have updated it
and may assume that the CRQ was successful.

Fixes: 6b278c0cb378 ("ibmvnic delay complete()")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index 86d52217189255b69c695db40329959beeaf37fd..c73c699600a8a1b45511952f6206d53e47e016fa 100644 (file)
@@ -5323,9 +5323,9 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
                        }
 
                        if (!completion_done(&adapter->init_done)) {
-                               complete(&adapter->init_done);
                                if (!adapter->init_done_rc)
                                        adapter->init_done_rc = -EAGAIN;
+                               complete(&adapter->init_done);
                        }
 
                        break;