Message ID | 20220225040941.1429630-3-sukadev@linux.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ibmvnic: Fix a race in ibmvnic_probe() | expand |
On Thu, 24 Feb 2022 20:09:35 -0800 Sukadev Bhattiprolu wrote: > 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()") As you resend please fix to: Fixes: 6b278c0cb378 ("ibmvnic: delay complete()") There's a : missing. Also in patch three make reinit_init_done() non-inline to keep with the netdev recommendations.
Jakub Kicinski [kuba@kernel.org] wrote: > On Thu, 24 Feb 2022 20:09:35 -0800 Sukadev Bhattiprolu wrote: > > 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()") > > As you resend please fix to: > > Fixes: 6b278c0cb378 ("ibmvnic: delay complete()") > > There's a : missing. Ah sorry. > > Also in patch three make reinit_init_done() non-inline to keep with > the netdev recommendations. I had already resent and the patches were merged this morning. Will send a patch to drop the inline. Thanks Sukadev
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 27a698171d67..830f3e45ec65 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -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;
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> --- drivers/net/ethernet/ibm/ibmvnic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)