From patchwork Wed Feb 13 21:32:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158256 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp560799jaa; Wed, 13 Feb 2019 13:32:31 -0800 (PST) X-Received: by 2002:a37:cf56:: with SMTP id e83mr210154qkj.101.1550093551701; Wed, 13 Feb 2019 13:32:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550093551; cv=none; d=google.com; s=arc-20160816; b=p2G2LoIUiFJnB8hjsg+sNSSTOUHIq4qqVGJwoAMgIeKqaKhQAlXTE5bkoU4tN5/b5c Xx0zVIVde0Oxyh8T5syxrns59VBUp/zQqdOUYot/R9m+b+c5vjYVeDteW6zaGpN6cYYn /CPXqAYDoczQbyzUn3slckMCBukltWU0hMuIXyh9cWNn4OlwMnGvd+eKLJ8Tp4RbcLxo X4aSprGYGy7aYdokuKw/pr/cq9S2pSFkFpcGLRRJG8I145xx6w0FeE9h/9OQUmVac6rC PmqjH5pm0r+o/25eQo2IbVYv7SH7686JkCXBr45izu13JJXLDXMVxZ3BFoJNq7ZllxoZ PMsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XKNS61az1WGOd8AWFZ4ZTIsUVQ0LSar+s/KyUDJcDZM=; b=CzlKhSOoMH722ruCcH8pcjaVSQoyI1PNF+141xOFzU3hVL6XMVchAEetGebzkJAplb e4wmVBsKJ62s7XN2bpgjTFProZxZOe1ygy1ZSzL4YdplsYw5h1WrTGyI7GscE9cYY5yl GLW+i7zRcmmZ71GoPqp9ce1AevMq0m8lXnq/WyBmtzLtzAGmm2H8YQYGVEtY4eK6Vdpf zCE8U7Tw3sHaUAfThuQ0J+6UuC+UMPuJHuXzFMQHRZ8aFgOefZiWQPGgiFiUngPzcOTL CmjIoeXeBqRM07LiKRTOEdUQk5a7BxsyJ0X1utun+VPP5+doP25waLVUXaDexd13zDax t9Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KL+czqKk; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y2sor583966qtb.0.2019.02.13.13.32.31 for (Google Transport Security); Wed, 13 Feb 2019 13:32:31 -0800 (PST) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KL+czqKk; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XKNS61az1WGOd8AWFZ4ZTIsUVQ0LSar+s/KyUDJcDZM=; b=KL+czqKkXMMB508fq669G8sT+oinM88F0RwPUXD47WYPeCn3WLKCVKUEffgwBJq773 Bg1l2Idlw4ewZ01aKj8lj1coFPtuAL3watPBEPI0V1YOSoDdePcdZB8Th3Fd3c0qQWUv 9PHttCq3XE4t+Wgv1+Od9KHuSsuezWVZO4EV+qtM7rzYx61k6AeU+ooiynssjwKJsgSE /dlmUOsLQF+2QCdYMAHoMSSlAEoiaEMG5c7qpJ6d4se4O0aALSlTRnnsKxhoSXQc2K// ilgZIL3sdIklo9RYYGOMyomibbU7A4nJ4qtH3wT1x9FoXpGyuxCFuDjugd7OXe3YmVEl u4ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XKNS61az1WGOd8AWFZ4ZTIsUVQ0LSar+s/KyUDJcDZM=; b=iQCCm5D7aYoCGyFD0qjsCB7Gk/Dv+Wtzp3fMEBTJVVzhcDuLzO03rd9iMtGsCmzOHm QbmuZ7RuFVtVLRLclmBIzB+tguUWOyz2uVk3WFKyXKzk70U0bkFHgKk4x8bBgZuGE8gw rh2HoOkkTLqZZfGhqTqz/5/RoyxfUIx/cDjsdlywp4JhDVrrZ+d14LtiD6lWunWlA3au QdbkrO4r8vXpdL/y24ZjcJ08qbnMTL0495vN7AUGw6rpbiV2t5ic9drFThtIekfDrBhH 9PmBUxMk51kKl+KMeVOTs2BSC7wQOdV67lYfO++ylsLWd8ccFHDgqqmGmuOj/jqu49GV DZxA== X-Gm-Message-State: AHQUAuZp9HrDB6AmjBvXq2VbpH+9CQQsLPFFhWg+aQEUYf5odCQvrd1j 2FW7Ywix73abA5UraKQ3fFJL89gZ X-Google-Smtp-Source: AHgI3IafCpIs/y9rPR16co2x66QKSVzJyNLtvmMs6gDQZEW/2cbXdskUKQ+2kKteni/lPrG/s6kmDg== X-Received: by 2002:aed:2044:: with SMTP id 62mr224159qta.11.1550093551451; Wed, 13 Feb 2019 13:32:31 -0800 (PST) Return-Path: Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id 8sm382675qtr.7.2019.02.13.13.32.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 13:32:30 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Julien Thierry , Tony Lindgren , Marc Zyngier , Greg KH , Mark Rutland Cc: Will Deacon , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH 4.19 04/17] ARM: 8792/1: oabi-compat: copy oabi events using __copy_to_user() Date: Wed, 13 Feb 2019 16:32:10 -0500 Message-Id: <20190213213223.916-5-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213213223.916-1-dave.long@linaro.org> References: <20190213213223.916-1-dave.long@linaro.org> From: Julien Thierry Commit 319508902600c2688e057750148487996396e9ca upstream. Copy events to user using __copy_to_user() rather than copy members of individually with __put_user_error(). This has the benefit of disabling/enabling PAN once per event intead of once per event member. Signed-off-by: Julien Thierry Signed-off-by: Russell King Signed-off-by: David A. Long --- arch/arm/kernel/sys_oabi-compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c index f0dd4b6ebb63..40da0872170f 100644 --- a/arch/arm/kernel/sys_oabi-compat.c +++ b/arch/arm/kernel/sys_oabi-compat.c @@ -277,6 +277,7 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, int maxevents, int timeout) { struct epoll_event *kbuf; + struct oabi_epoll_event e; mm_segment_t fs; long ret, err, i; @@ -295,8 +296,11 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, set_fs(fs); err = 0; for (i = 0; i < ret; i++) { - __put_user_error(kbuf[i].events, &events->events, err); - __put_user_error(kbuf[i].data, &events->data, err); + e.events = kbuf[i].events; + e.data = kbuf[i].data; + err = __copy_to_user(events, &e, sizeof(e)); + if (err) + break; events++; } kfree(kbuf);