Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp809002ybl; Fri, 9 Aug 2019 14:18:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqySQ3JBB5OWhprlBAFgFJRuf7A9Y4Xc5Pfg3j8rARFM8HbgDpKJJ6oKJZG7FU1hfCpyYcjL X-Received: by 2002:a65:430a:: with SMTP id j10mr19827541pgq.374.1565385496337; Fri, 09 Aug 2019 14:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565385496; cv=none; d=google.com; s=arc-20160816; b=gg4w3Bv7GDOGEfR2amNkGrdXXISrUNRvzu6tADIgKRjqUfuqcKsJgK7nBTw3rg4SYw WJIyDfQNpgOORAJFe3dozG66uhxJQwv5ESpy/PR7Eb12019Zu3ItEIjF9NRf4maJqtSh Bo6Y79PlrREUSzo1VT/0d5Oh4SWVeZsPWGr25JqStWD7UlwnHtpenV/5H54PI92Ft6W0 gfbJKiBzC8m3qicvA1tk0iOR8N44hzTgq5B+1HxtsZUOtSLP0Ng8VwU1A/cOVIGx7wug uPRXQAyYfmoa2voVx5JfBUkZHrtyfAW/5oiSZ1prhkLXAEifXvl9TrynTF3w0Lbo6eba ujmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=8GC51esmJAMemctQ8NRQZocGfyl2HrGEQQBZNCBvgSE=; b=Qp852gD8NCDMgX8iOGZRTOn0os2W80AFXF19aXzlhh2nWmsFbU/jltR4ShLGa/KLzh OQwH8FKAyf7mb1W5WteBwr1QCCue/uFgFqU2/qglJX/dQ+MIEdPRPimdF5E9VWvef90G 0h4ptnfxFD9KEJCgeVGRn9oZsxoELBU1OpTokWaa0UGW/95mrhN/ZptY9nmZ8u29Ugsz y92o/67Ai5++aJqs4Ms6YnQao4b8cgFF9A7j/UTDVYegVrN+mjDDYTPzdHUjUam4/BIo O3bA9VPYOlUwUaFvxdY7azqlMBNrkZNj/62E5G50VeV8E3DXpV2Zrh6z/XU93iEaWXpj a/2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019071901 header.b=UpBT+PDV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si17056997pgk.508.2019.08.09.14.18.00; Fri, 09 Aug 2019 14:18:16 -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; dkim=pass header.i=@zytor.com header.s=2019071901 header.b=UpBT+PDV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726727AbfHIVRA (ORCPT + 99 others); Fri, 9 Aug 2019 17:17:00 -0400 Received: from terminus.zytor.com ([198.137.202.136]:33063 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbfHIVRA (ORCPT ); Fri, 9 Aug 2019 17:17:00 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x79LGMLZ3828121 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 9 Aug 2019 14:16:22 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x79LGMLZ3828121 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019071901; t=1565385383; bh=8GC51esmJAMemctQ8NRQZocGfyl2HrGEQQBZNCBvgSE=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=UpBT+PDVElDI0d2QSG3+x9QDdRPvLYP3hxWn93rsf0UvfqZS5JP8xdVPJTPD5Filj vrm/tbaPpr3mqZvm/0lWkESFXdbbhvCiT8+uqhkpuyyweDCXSqm+G1FKGkTBFj9zwC NQzFA2Pj1NYpn1l+golnzN7zzCRKocSxPP8x/Q5afuQ2R70OoI/MFcDXvtwLbUkkkm Hguqftza2023vmIouL8N098BxyMYZAgfzAFgQfxeRiYFnW7KCMst7WkFmhxSqwkpAu tcxGJsWHMe2n6MwKdomnELjQ2PArxaJ9gjyvobfFufivS6p2FZF5ETOYlVMiBRLN0z aGusTYkY0w0AQ== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x79LGL2s3828118; Fri, 9 Aug 2019 14:16:21 -0700 Date: Fri, 9 Aug 2019 14:16:21 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Josh Poimboeuf Message-ID: Cc: linux-kernel@vger.kernel.org, ndesaulniers@google.com, tglx@linutronix.de, sedat.dilek@gmail.com, hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, chris@chris-wilson.co.uk, jpoimboe@redhat.com Reply-To: hpa@zytor.com, tglx@linutronix.de, sedat.dilek@gmail.com, linux-kernel@vger.kernel.org, ndesaulniers@google.com, jpoimboe@redhat.com, chris@chris-wilson.co.uk, mingo@kernel.org, peterz@infradead.org In-Reply-To: <51a4155c5bc2ca847a9cbe85c1c11918bb193141.1564086017.git.jpoimboe@redhat.com> References: <51a4155c5bc2ca847a9cbe85c1c11918bb193141.1564086017.git.jpoimboe@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:core/urgent] drm/i915: Remove redundant user_access_end() from __copy_from_user() error path Git-Commit-ID: e6a9522ac3ff59980ea00e070b6b8573aface36a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=1.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, FREEMAIL_FORGED_REPLYTO autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e6a9522ac3ff59980ea00e070b6b8573aface36a Gitweb: https://git.kernel.org/tip/e6a9522ac3ff59980ea00e070b6b8573aface36a Author: Josh Poimboeuf AuthorDate: Thu, 25 Jul 2019 15:29:57 -0500 Committer: Thomas Gleixner CommitDate: Fri, 9 Aug 2019 23:13:25 +0200 drm/i915: Remove redundant user_access_end() from __copy_from_user() error path Objtool reports: drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: .altinstr_replacement+0x36: redundant UACCESS disable __copy_from_user() already does both STAC and CLAC, so the user_access_end() in its error path adds an extra unnecessary CLAC. Fixes: 0b2c8f8b6b0c ("i915: fix missing user_access_end() in page fault exception case") Reported-by: Thomas Gleixner Reported-by: Sedat Dilek Signed-off-by: Josh Poimboeuf Signed-off-by: Thomas Gleixner Tested-by: Nick Desaulniers Tested-by: Sedat Dilek Acked-by: Peter Zijlstra (Intel) Acked-by: Chris Wilson Link: https://github.com/ClangBuiltLinux/linux/issues/617 Link: https://lkml.kernel.org/r/51a4155c5bc2ca847a9cbe85c1c11918bb193141.1564086017.git.jpoimboe@redhat.com --- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c index 5fae0e50aad0..41dab9ea33cd 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -1628,6 +1628,7 @@ static int check_relocations(const struct drm_i915_gem_exec_object2 *entry) static int eb_copy_relocations(const struct i915_execbuffer *eb) { + struct drm_i915_gem_relocation_entry *relocs; const unsigned int count = eb->buffer_count; unsigned int i; int err; @@ -1635,7 +1636,6 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb) for (i = 0; i < count; i++) { const unsigned int nreloc = eb->exec[i].relocation_count; struct drm_i915_gem_relocation_entry __user *urelocs; - struct drm_i915_gem_relocation_entry *relocs; unsigned long size; unsigned long copied; @@ -1663,14 +1663,8 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb) if (__copy_from_user((char *)relocs + copied, (char __user *)urelocs + copied, - len)) { -end_user: - user_access_end(); -end: - kvfree(relocs); - err = -EFAULT; - goto err; - } + len)) + goto end; copied += len; } while (copied < size); @@ -1699,10 +1693,14 @@ end: return 0; +end_user: + user_access_end(); +end: + kvfree(relocs); + err = -EFAULT; err: while (i--) { - struct drm_i915_gem_relocation_entry *relocs = - u64_to_ptr(typeof(*relocs), eb->exec[i].relocs_ptr); + relocs = u64_to_ptr(typeof(*relocs), eb->exec[i].relocs_ptr); if (eb->exec[i].relocation_count) kvfree(relocs); }