From mboxrd@z Thu Jan 1 00:00:00 1970 From: Denis Bolotin Subject: [PATCH net 4/4] qed: Fix reading wrong value in loop condition Date: Sun, 11 Nov 2018 17:05:00 +0200 Message-ID: <20181111150500.4345-5-denis.bolotin@cavium.com> References: <20181111150500.4345-1-denis.bolotin@cavium.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , Denis Bolotin To: , Return-path: Received: from mail-eopbgr720058.outbound.protection.outlook.com ([40.107.72.58]:22782 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728500AbeKLA4X (ORCPT ); Sun, 11 Nov 2018 19:56:23 -0500 In-Reply-To: <20181111150500.4345-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..aa7504a 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 */ + 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