From patchwork Sat May 1 08:15:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12234693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A698C433B4 for ; Sat, 1 May 2021 08:15:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E6BB761406 for ; Sat, 1 May 2021 08:15:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6BB761406 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5C4A16B006C; Sat, 1 May 2021 04:15:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5832C6B006E; Sat, 1 May 2021 04:15:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 415A36B0070; Sat, 1 May 2021 04:15:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 27DAB6B006C for ; Sat, 1 May 2021 04:15:53 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D7B10181AC9CB for ; Sat, 1 May 2021 08:15:52 +0000 (UTC) X-FDA: 78091953744.20.0463177 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf25.hostedemail.com (Postfix) with ESMTP id B2C266000128 for ; Sat, 1 May 2021 08:15:46 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4FXMWB4wshz9sRr; Sat, 1 May 2021 10:15:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HMIzFJMW1339; Sat, 1 May 2021 10:15:50 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4FXMWB41GFz9sRq; Sat, 1 May 2021 10:15:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 686338B76F; Sat, 1 May 2021 10:15:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Y2T5rQuBPH_a; Sat, 1 May 2021 10:15:50 +0200 (CEST) Received: from po15610vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 33A598B763; Sat, 1 May 2021 10:15:50 +0200 (CEST) Received: by po15610vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 05CE0642A5; Sat, 1 May 2021 08:15:49 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH RESEND] iov_iter: Use user_read_access_begin() instead of user_access_begin() To: Alexander Viro , Andrew Morton Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org Date: Sat, 1 May 2021 08:15:49 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf25.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B2C266000128 X-Stat-Signature: attamq8kgwyukq6ah1d83td1h51afzcb Received-SPF: none (csgroup.eu>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=pegase2.c-s.fr; client-ip=93.17.235.10 X-HE-DKIM-Result: none/none X-HE-Tag: 1619856946-786248 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: copy_compat_iovec_from_user() only do unsafe_get_user(), it only requires read access. Signed-off-by: Christophe Leroy --- Resending with mm list in addition lib/iov_iter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 61228a6c69f8..fd9bd229d51d 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1932,7 +1932,7 @@ static int copy_compat_iovec_from_user(struct iovec *iov, (const struct compat_iovec __user *)uvec; int ret = -EFAULT, i; - if (!user_access_begin(uiov, nr_segs * sizeof(*uiov))) + if (!user_read_access_begin(uiov, nr_segs * sizeof(*uiov))) return -EFAULT; for (i = 0; i < nr_segs; i++) { @@ -1953,7 +1953,7 @@ static int copy_compat_iovec_from_user(struct iovec *iov, ret = 0; uaccess_end: - user_access_end(); + user_read_access_end(); return ret; }