]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:14:15 +0000 (19:14 +0100)
[ Upstream commit 765559b10ce514eb1576595834f23cdc92125fee ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c

index 996da870dafe28cd31f3437de06bcaae62c72cc5..945a84c2134f6b17818442b010cc607f74c1358a 100644 (file)
@@ -5319,9 +5319,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;