From mboxrd@z Thu Jan 1 00:00:00 1970 From: Denis Bolotin Subject: [PATCH net v2 4/4] qed: Fix reading wrong value in loop condition Date: Mon, 12 Nov 2018 12:50:23 +0200 Message-ID: <20181112105023.23842-5-denis.bolotin@cavium.com> References: <20181112105023.23842-1-denis.bolotin@cavium.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Denis Bolotin To: , Return-path: Received: from mail-sn1nam02on0050.outbound.protection.outlook.com ([104.47.36.50]:59443 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728651AbeKLUn6 (ORCPT ); Mon, 12 Nov 2018 15:43:58 -0500 In-Reply-To: <20181112105023.23842-1-denis.bolotin@cavium.com> Sender: netdev-owner@vger.kernel.org List-ID: The value of "sb_index" is written by the hardware. Reading its value and writing it to "index" must finish before checking the loop condition. Signed-off-by: Denis Bolotin Signed-off-by: Michal Kalderon --- drivers/net/ethernet/qlogic/qed/qed_int.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c index 0f0aba7..b22f464 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_int.c +++ b/drivers/net/ethernet/qlogic/qed/qed_int.c @@ -992,6 +992,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn) */ do { index = p_sb_attn->sb_index; + /* finish reading index before the loop condition */ + dma_rmb(); attn_bits = le32_to_cpu(p_sb_attn->atten_bits); attn_acks = le32_to_cpu(p_sb_attn->atten_ack); } while (index != p_sb_attn->sb_index); -- 1.8.3.1