From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 1AA6CC43465 for ; Mon, 21 Sep 2020 14:36:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6657222BB for ; Mon, 21 Sep 2020 14:36:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pNtq+qIk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Cr3xQBVQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6657222BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HT1yandAeEufFDmaK0pwXS7GjfAeMbb4wU6fXrbtGvI=; b=pNtq+qIkr710nqTVkrM7eyjzE Iq6KsH+9NR711gxqjJkYM5p1I3dHm862FgeLRbxO88GnuRMRzbTgevm13/UBM+2uvBElVaU24Ew39 Re0j/xceBa1bgOeFRjcaCaLJJVDiJOXEAfovNTueutqMl+7rK5C+C9fMh7s5qWRZ4974wHsBHa/ct 9EyySfU+GPUmB7gWwk9O17C9KjEW7HvAbjVqsfRDfd75+1gO3/Y+SiJzXcftrgdyCHJmsVlZsKjKz sJmupDvU6Tqlrp9ECcutv94pmtPODi6pF6OY85B1oIAeeBvkahV4GwOaBeuwmolaFe0nMZ71by/Zw A+Khamx/A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKMu2-0002mr-Ml; Mon, 21 Sep 2020 14:34:50 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKMtd-0002dO-Sn for linux-arm-kernel@merlin.infradead.org; Mon, 21 Sep 2020 14:34:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=hvHVjgb7+ogIHMv2QziVfmEo4wIHVDzxSBO7sgqq+LI=; b=Cr3xQBVQWALKH7tuoir4RRrOx5 ObtytscKgX2pD9jdFKZl7OAaSGqHvKMY6QdN1AAeL7iPRdfGMnnuAKRp2fO3zs/Qa1qanBrJcMzlp 2i6iNQiXjZlAfSdr8eSouVvMxW6Jwy5mKeEirvXr3ZTTiIIwvkxrQMh9XAJw5QuRUQsbNqdCQQyyW WDrgFWFBzIj4YkZNzY0XDygo/V19wuSoL2WQzUur+fGNL+3uLi2J6QXLcsQR+yhOTXD5FmYG9PgHH hyhjGiAZI27lRyg9jFDzu3lo4ZZQVp8d384XapZSVtaSeOjqaz3u6nukSqWN2rkY3CEe6gIiU4FAO cLQDX6OQ==; Received: from p4fdb0c34.dip0.t-ipconnect.de ([79.219.12.52] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKMtc-0007rU-GX; Mon, 21 Sep 2020 14:34:24 +0000 From: Christoph Hellwig To: Alexander Viro Subject: [PATCH 04/11] iov_iter: explicitly check for CHECK_IOVEC_ONLY in rw_copy_check_uvector Date: Mon, 21 Sep 2020 16:34:27 +0200 Message-Id: <20200921143434.707844-5-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921143434.707844-1-hch@lst.de> References: <20200921143434.707844-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aio@kvack.org, linux-mips@vger.kernel.org, David Howells , linux-mm@kvack.org, keyrings@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, Arnd Bergmann , linux-block@vger.kernel.org, io-uring@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jens Axboe , linux-parisc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, David Laight , linux-fsdevel@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Explicitly check for the magic value insted of implicitly relying on its numeric representation. Also drop the rather pointless unlikely annotation. Signed-off-by: Christoph Hellwig --- lib/iov_iter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index d7e72343c360eb..a64867501a7483 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1709,8 +1709,7 @@ static ssize_t rw_copy_check_uvector(int type, ret = -EINVAL; goto out; } - if (type >= 0 - && unlikely(!access_ok(buf, len))) { + if (type != CHECK_IOVEC_ONLY && !access_ok(buf, len)) { ret = -EFAULT; goto out; } @@ -1824,7 +1823,7 @@ static ssize_t compat_rw_copy_check_uvector(int type, } if (len < 0) /* size_t not fitting in compat_ssize_t .. */ goto out; - if (type >= 0 && + if (type != CHECK_IOVEC_ONLY && !access_ok(compat_ptr(buf), len)) { ret = -EFAULT; goto out; -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel