Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6251410imu; Mon, 21 Jan 2019 05:52:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN6sFBMGsM5kS2kvtB5xSPVfaHTcJKp+LvkwvWevpGED4+jvT8FYutgdLK05Bsm8xgWJfc2L X-Received: by 2002:a63:104d:: with SMTP id 13mr28369914pgq.303.1548078739262; Mon, 21 Jan 2019 05:52:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078739; cv=none; d=google.com; s=arc-20160816; b=A0H7fcbjUU425q4T3bHB73wx0aYSo4DvzEOLGJyXooOxNsJIL5lcZ4m7ZzCzSzRtJJ H9Q5YrX3sVAKzW26rjvbANeoLL7HiMU6pq0RXhPMcj6a/kTSARVtu+pWUwQIopt1o9m1 0MFvHu+fU1wL6SNRGQV9RMiN4Luh2luwJrIHm4V+TXoGpEh/BURfrIN0zOTNbkbDZ3t3 S5KeK79jguoXyQJk15tKqvnzX60loJP5taaQrjDvniiugZ8PuidKd/omfpKJuvzfRNii djoS5LbzuzNAndyQOVRHNe3BGwNw0OrBy0h3/UH1cXgobpkK/FavItAcCjfly/D4VIne GICw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YVs9r9Hlc0BkSv9owyIzdOyGw0+c/TWxbND5GqFI8tM=; b=AEiNdc6GWqtE6/4NO7s2zsJ7Fcnxni7w4pNpUDNdJgF63jaFidw0TMlGNTDYEHRDEB jDYfpebdumDw+DObSVuuMX32VPLZ7qEJ8VAuoeLrPD/CFZOgBwrS1FipaZnqAGS/Guwz 1nY2iO+wPen/qqWAkrzoHWP9ub8rTR3Y5O+cDBMG/wxsyHm8sC8F6UeVW70K9u1vCYXG JJ21QSkKY6dVClmtacc7rWO62i5VI0ufSQIHUdMy00WVLWpyFrRk0tsxPm/gRQvOT/fW EPun3cs4BaTNH50K+YkWWNju3bMMU+O79ieDbZ4mihYWFc2bQvEZYqOicjH7FBQ74RxR UqRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0r95DyN8; 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 h189si12243822pfc.211.2019.01.21.05.52.03; Mon, 21 Jan 2019 05:52:19 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=0r95DyN8; 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 S1730051AbfAUNsy (ORCPT + 99 others); Mon, 21 Jan 2019 08:48:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:58972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729441AbfAUNsu (ORCPT ); Mon, 21 Jan 2019 08:48:50 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CBF7320879; Mon, 21 Jan 2019 13:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078529; bh=iCAjZKFux/eGfJTBKSCXoTkjwDxGLSYbg1OuQHcAxLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0r95DyN8khz91o9Tkv93tKnfavuuHQCWBpJFO7lUCRsAfSIdbq/96Rrip5QxjifQo o/J4Q2Wp8CYoG5PAp8jJXoptmoAWTkXjOAtPqL/staFWbCjkLptmgYTxg89KAhVXEV pWp30MPL1nbR8hRKL/XktZfKXicuqpn5m6hultrQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Trond Myklebust , Anna Schumaker Subject: [PATCH 4.20 065/111] SUNRPC: Fix TCP receive code on archs with flush_dcache_page() Date: Mon, 21 Jan 2019 14:42:59 +0100 Message-Id: <20190121122503.621264445@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Trond Myklebust commit 6a829eb8619fbdde6d7d627ad582fe119805f39d upstream. After receiving data into the page cache, we need to call flush_dcache_page() for the architectures that define it. Fixes: 277e4ab7d530b ("SUNRPC: Simplify TCP receive code by switching...") Reported-by: Geert Uytterhoeven Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.20 Tested-by: Geert Uytterhoeven Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/xprtsock.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -380,6 +381,26 @@ xs_read_discard(struct socket *sock, str return sock_recvmsg(sock, msg, flags); } +#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE +static void +xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek) +{ + struct bvec_iter bi = { + .bi_size = count, + }; + struct bio_vec bv; + + bvec_iter_advance(bvec, &bi, seek & PAGE_MASK); + for_each_bvec(bv, bvec, bi, bi) + flush_dcache_page(bv.bv_page); +} +#else +static inline void +xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek) +{ +} +#endif + static ssize_t xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags, struct xdr_buf *buf, size_t count, size_t seek, size_t *read) @@ -413,6 +434,7 @@ xs_read_xdr_buf(struct socket *sock, str seek + buf->page_base); if (ret <= 0) goto sock_err; + xs_flush_bvec(buf->bvec, ret, seek + buf->page_base); offset += ret - buf->page_base; if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC)) goto out;