Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3005635imm; Sun, 1 Jul 2018 10:08:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLz0Ma9RIDKdisFhGfyF1kfmsBeqdRhElyuvli5T8QRfNGAKiZXz72aqFm67GhGKD172Kpc X-Received: by 2002:a17:902:112b:: with SMTP id d40-v6mr23126731pla.123.1530464903982; Sun, 01 Jul 2018 10:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530464903; cv=none; d=google.com; s=arc-20160816; b=cVHkdsilxmrW39LUaFF0JQs2UAjhqA54fYd1W7KmHlGkpmiqE+blEr4ap83UjDzbS8 ikwWLunQpb2B4gtm7QufTCrNYr7IyPISKe/jLte59lp81yZUdpjVQqN3WtrqN10IrECR 3/Br3oLcaTc2OuLITjzHpcn6k4XX3LH3+NE5usfwbIfdieo4FASK9Zp68O4eZqr8ZijU 7ff8s3Lgvw/a9hRZIBh9/bWURdt3efvPHhfjakCjd74P8iZkaeL1JSkL3hvSQVs4MZod MdoZ+cE1T99AnNau8rysWKzOE5HxUeY1pAudtNiYoyD213UUYDtNh/n9mPVpk6UR7PEX 5F7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=2YHQIYV6Lft0DWUB7MovyrnQAyMvzjyUSHMEIsKl21U=; b=Wf2Ecry1tCXnQ6jXd+5xM+hVSbyzVjJRRd9UHt2WkCZED8V7SZwTihLM+NR90Q6kbk bmiBuq4V/7g0uhDBuAgwpBn7dokoyh8VEXZ1aNGsYiFHYvAdwhcM+IyQNQ+UXbkI++OA BTLpWyFiiixfOiPztHkcdx92qdtkMnG3xOGSeBVO1ekiBI012LADCQNPswgefnTqtsGz bv9E+nfDfka03JHVrLHnhm0I8D+hbEccDOV+7k/xPaQjuWCn/E5Aruw5r5BRPKXhdkvm U+ggEcUMoDLumUfSvh5pvb4TbvEI5ie3FO5E3z/oNQrEmwmhX1ulDiNiXBOO/X01G7pJ 6+IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k130-v6si14700951pfc.335.2018.07.01.10.08.09; Sun, 01 Jul 2018 10:08:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933813AbeGARGl (ORCPT + 99 others); Sun, 1 Jul 2018 13:06:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37546 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032142AbeGAQmK (ORCPT ); Sun, 1 Jul 2018 12:42:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 60FBAACC; Sun, 1 Jul 2018 16:42:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Paul Burton , James Hogan , linux-mips@linux-mips.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen Subject: [PATCH 4.17 123/220] MIPS: io: Add barrier after register read in inX() Date: Sun, 1 Jul 2018 18:22:27 +0200 Message-Id: <20180701160913.484857102@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Huacai Chen commit 18f3e95b90b28318ef35910d21c39908de672331 upstream. While a barrier is present in the outX() functions before the register write, a similar barrier is missing in the inX() functions after the register read. This could allow memory accesses following inX() to observe stale data. This patch is very similar to commit a1cc7034e33d12dc1 ("MIPS: io: Add barrier after register read in readX()"). Because war_io_reorder_wmb() is both used by writeX() and outX(), if readX() need a barrier then so does inX(). Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen Patchwork: https://patchwork.linux-mips.org/patch/19516/ Signed-off-by: Paul Burton Cc: James Hogan Cc: linux-mips@linux-mips.org Cc: Fuxin Zhang Cc: Zhangjin Wu Cc: Huacai Chen Signed-off-by: Greg Kroah-Hartman --- arch/mips/include/asm/io.h | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -414,6 +414,8 @@ static inline type pfx##in##bwlq##p(unsi __val = *__addr; \ slow; \ \ + /* prevent prefetching of coherent DMA data prematurely */ \ + rmb(); \ return pfx##ioswab##bwlq(__addr, __val); \ }