Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4675091ybl; Mon, 3 Feb 2020 23:40:46 -0800 (PST) X-Google-Smtp-Source: APXvYqx8RqQiIf9k5iT3dGJ86Px26disUUyU6BRXOSg9ChPpr1b//aDgbaKMo9R4DhALuM8WyeVx X-Received: by 2002:a05:6830:22ee:: with SMTP id t14mr20736167otc.236.1580802046193; Mon, 03 Feb 2020 23:40:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580802046; cv=none; d=google.com; s=arc-20160816; b=q4H2skeEfcSPLQ5FPWQUCoInhbBU4YJQ+6FW/iUbg82Ul5246Plr6bCuTQDIMaEFMC iR7yiuToPdLUopCCmLFOjNeZBREp5bA/t8uz3KwcWyZUfE6BtCEC++3kitWQPt5WL4O2 osP0NUyVXWBQWDvhdsUZ2N3aPlyzdXmrCkqCmevLq7jTAIH8fTLO+2yq7/oVK7WCdz6R 9MiBlkmlgnoSQsL95KZUUy0Mf02IN8wH7ioikn7sS+SnFEG+LJG8oRfToetcsTHU0aWi H5/QO+tOg6XGOCpSjn2VBLXXeEZeRp0mLl4JGK2f2AEDR/x3Enapm6Vne10SpHG3OOXf Hfsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=U1AHLSwYmLZKMZ8UPNMZkSiUNqsky6WI99+EhVLVRtg=; b=Wd1Rhwsqzj0RrQSo5Pe1tkWLJdqABrXIpTEYZ9yggmLINOv9iNhHkWZXHaYapuLj/Z V1goIh8ENnmN1WiElH+7b+aIttXM7GC/WGt3WS8bzpgJBHU6TLfvMpTxo116j15Bnr9y ek9RIRSK74pd3CZi9wRGgFI3Y/WBi8R9j/DJFs1aJ5pSbF1IMre9w111ZXsTWAY1GvUb If3jmeDPqYKzPihqmM3THZ19wVHUmOtamuTy0D0GDhpLE7LlpeLVzechaz+HKEsF+57v 0f+91xnuwq43nCHFWVRuS6eanmMJCk4XLLsGgLQG/xjY/Qmr5ILIJ9of/Jd5dL70FdVv e6ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=STJrFUAo; 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 d28si3031325oic.47.2020.02.03.23.40.34; Mon, 03 Feb 2020 23:40:46 -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=@c-s.fr header.s=mail header.b=STJrFUAo; 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 S1727170AbgBDHiC (ORCPT + 99 others); Tue, 4 Feb 2020 02:38:02 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:62162 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbgBDHh6 (ORCPT ); Tue, 4 Feb 2020 02:37:58 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48Bc422bwXz9vC1f; Tue, 4 Feb 2020 08:37:54 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=STJrFUAo; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id cGRhIBh6BLiA; Tue, 4 Feb 2020 08:37:54 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48Bc420z15z9vC1c; Tue, 4 Feb 2020 08:37:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1580801874; bh=U1AHLSwYmLZKMZ8UPNMZkSiUNqsky6WI99+EhVLVRtg=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=STJrFUAojpZMlBQ0FHwHcbs/fBZ7fxLzpNYYqrkvPJJqz3+koDHe6v+T0Re2INLfx LXm3A47Li2whXat/jQSMFCPM2rFrYS3XPK8dAGBbVoAAq1QpparBLD2VggZao17ESO W7tEals6UUmW/Dqps9KRuDk4DAJvUrRRtE+HX89A= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 11C088B7B6; Tue, 4 Feb 2020 08:37:55 +0100 (CET) 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 eQvB3hbRqHXp; Tue, 4 Feb 2020 08:37:55 +0100 (CET) Received: from po14934vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C99DC8B755; Tue, 4 Feb 2020 08:37:54 +0100 (CET) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 947C4652B3; Tue, 4 Feb 2020 07:37:54 +0000 (UTC) Message-Id: <68214046bffd67b47ca0027f4cc62599ac63bb2d.1580801787.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH 3/4] drm/i915/gem: Replace user_access_begin by user_write_access_begin To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 4 Feb 2020 07:37:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When i915_gem_execbuffer2_ioctl() is using user_access_begin(), that's only to perform unsafe_put_user() so use user_write_access_begin() in order to only open write access. Signed-off-by: Christophe Leroy --- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c index d5a0f5ae4a8b..f8ebd54fe69c 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -1610,14 +1610,14 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb) * happened we would make the mistake of assuming that the * relocations were valid. */ - if (!user_access_begin(urelocs, size)) + if (!user_write_access_begin(urelocs, size)) goto end; for (copied = 0; copied < nreloc; copied++) unsafe_put_user(-1, &urelocs[copied].presumed_offset, end_user); - user_access_end(); + user_write_access_end(); eb->exec[i].relocs_ptr = (uintptr_t)relocs; } @@ -1625,7 +1625,7 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb) return 0; end_user: - user_access_end(); + user_write_access_end(); end: kvfree(relocs); err = -EFAULT; @@ -2955,7 +2955,8 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, * And this range already got effectively checked earlier * when we did the "copy_from_user()" above. */ - if (!user_access_begin(user_exec_list, count * sizeof(*user_exec_list))) + if (!user_write_access_begin(user_exec_list, + count * sizeof(*user_exec_list))) goto end; for (i = 0; i < args->buffer_count; i++) { @@ -2969,7 +2970,7 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, end_user); } end_user: - user_access_end(); + user_write_access_end(); end:; } -- 2.25.0