Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1359065imm; Tue, 2 Oct 2018 07:04:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV60brMPv/4NgSo5/fa4oc3YArZq7+HyTccSeEfRgQjj3ul4DHhmU+ms8bJifJ6rFZkspLNwm X-Received: by 2002:a65:594b:: with SMTP id g11-v6mr14590743pgu.260.1538489060223; Tue, 02 Oct 2018 07:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538489060; cv=none; d=google.com; s=arc-20160816; b=vtafqrfyydAVHOFeEfZaZtQvpfk0ACXIrbAkBUcW8DoTX+lIlNp5DRUdEMT2M3bLO9 A3n0CTszGkpo5obFB/9ixMNXtuCQD+2hSeNpLuoW8RTP/37NPjjI7g9aMitXuJ/u5fO9 UCIM6xYiLSvqpVDvuajnwMs9cqHLNZzczt37hDLE5xZ5lD0RpLRWW1zRd8CsD5Q06Ic1 pR/N3yW/mGe4wzJYOI8kCrPqqefD0NHhLxkMdAj4RvNtVVtxBSYyzG8gbRNVcOAYCGMe 04dH3u/1dtDDp87qGNzUl6i3XH8is2J6GFweAop4IouR/JHOJUA0Gqbc17OtNl/Dhaer kPdA== 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; bh=0ftwnCKjHeT+WgyBbJGfs+VCucQsJ3J6YHFvKVEAD1I=; b=FwqoFhmJdEJmTEKZ7ZPQ2K+5HYA1zYox1kWqpoMgVBBaauzxoFzPsLRzUS0kOR8aKe j5ImCBVEk8WaWOJGBw6nOLbT6miB4N4G6K7/EaUzUe3c4qcb8y8rA7tr18GHbKS5rIGY H1MJW2F/+Sjs5nsfiSD2HJJSzJv/xpo02L+0TbjN8XTp9wX/f+vXMrNjYVtKKx/2Opaw /KjFEhVCv21NAx+jhXIaNyuV6H7OlgEPZgzCPxHP+ammTT6CkrVbS6qKC16NUDLbRQCC g3yimjl+Ti+Dt1f92LHp9vNJkFEPLYu5x40kQ1h8hNM0WU3ERUFJAXYhOmceuB6gHn8r 55nA== 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 b3-v6si15277849plx.106.2018.10.02.07.04.05; Tue, 02 Oct 2018 07:04:20 -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 S1730082AbeJBUNE (ORCPT + 99 others); Tue, 2 Oct 2018 16:13:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33198 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730059AbeJBUNC (ORCPT ); Tue, 2 Oct 2018 16:13:02 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D70DDB2F; Tue, 2 Oct 2018 13:29:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fan Du , Dave Jiang , Vishal Verma , Wenwei Tao , Dan Williams Subject: [PATCH 4.18 157/228] uaccess: Fix is_source param for check_copy_size() in copy_to_iter_mcsafe() Date: Tue, 2 Oct 2018 06:24:14 -0700 Message-Id: <20181002132509.570370249@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132459.032960735@linuxfoundation.org> References: <20181002132459.032960735@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dave Jiang commit dfb06cba8c73c0704710b2e3fbe2c35ac66a01b4 upstream. copy_to_iter_mcsafe() is passing in the is_source parameter as "false" to check_copy_size(). This is different than what copy_to_iter() does. Also, the addr parameter passed to check_copy_size() is the source so therefore we should be passing in "true" instead. Fixes: 8780356ef630 ("x86/asm/memcpy_mcsafe: Define copy_to_iter_mcsafe()") Cc: Reported-by: Fan Du Signed-off-by: Dave Jiang Reviewed-by: Vishal Verma Reported-by: Wenwei Tao Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- include/linux/uio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -172,7 +172,7 @@ size_t copy_from_iter_flushcache(void *a static __always_inline __must_check size_t copy_to_iter_mcsafe(void *addr, size_t bytes, struct iov_iter *i) { - if (unlikely(!check_copy_size(addr, bytes, false))) + if (unlikely(!check_copy_size(addr, bytes, true))) return 0; else return _copy_to_iter_mcsafe(addr, bytes, i);