From patchwork Thu Feb 14 02:10:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158277 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp793703jaa; Wed, 13 Feb 2019 18:10:30 -0800 (PST) X-Received: by 2002:ac8:2e19:: with SMTP id r25mr1084512qta.0.1550110230546; Wed, 13 Feb 2019 18:10:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550110230; cv=none; d=google.com; s=arc-20160816; b=nry+E/O3KmbLXvtzoDpC8hSgW8+gO6HJ/veaKjjR0B8vEZdSLtCC4ma0Gf6hdKJaQk YHEUSynErkCYpPP+SmjdSpA45da+W60Rvc0jLezl3RQohy0zPZ9/42xQzd/1TmvWmV2A RoI9HteoHQtpwYjqsSpEEpXkg3UX7Ee/SzD3ecfAZKFdWiO7cNf+1SsuMJPZ6du9Ggv7 VhmI98naIobmdNhFSdVCygcEmozT3lLOF4FEnSMes+OtWimfZoQlhR9ljoLLnYg1dEhN 4Hm2MpLSgMKjJF4QfwXzl9iem9+r6bTZQFRW9M3WEp9sQRZkQXw6rdOEhrH9w5UwFMsc SoHA== 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=ao2zNPPAVKm6DVngcSIODmeIuZt8Da7c4FKcqwlcUWs=; b=BIytx0eG+FzKAFSYJxYyhp5xd2qDzKLRbdw2W9htB3qk0/p9jMQnYWSBLy41mxU8Gr /DSYmX5F2ojj0CbaS50ZwA4qotQJeSfXIDwTDH0BppQrFSJIpT4iFMW7y/ekstA9ahnD hI14LDcabaG8JqBQHg7wmvCYvwMrfhtk8qoQnJ9mPfNLclKUAccWyuSj8YBqD8Gn8+Jj ECUamc6nD30I5j/bvR2MUZI1KSQHChwF/l2i9uzpLTqsZd1uEfKFGn5XiTICuFYsBfwU H2895i7U7zjvdfQ6dAXVKvIS62Tw18cE+3WlNyJuKk1UUStMpnBloK54s5Ad2J7z5o89 p8dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UgLNxFkX; 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 a9sor1250634qtj.40.2019.02.13.18.10.30 for (Google Transport Security); Wed, 13 Feb 2019 18:10:30 -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=UgLNxFkX; 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=ao2zNPPAVKm6DVngcSIODmeIuZt8Da7c4FKcqwlcUWs=; b=UgLNxFkXN5F63atBRrO/+dam22AD9xcXt581af1qQdlsAytsMpzMy2XlygaxbDcy9/ IdR0Gl78bheX/LuIAHEvlKI4oUOuU+pKQ5vBGreBFVzSfcJK+pexDAHvgXYuJW6qEPBl MIfREGA1UDearL0vzEYwwS5sS6+qjjF/6wb3Gcbym8V1KeqLvP4ipKSLe9McwMp3CSNH UpqVvpyjWo1zfaHelNPDMWd0FCLwZQe6PSRRiNJ9ddj4VafKY8itk0YlzY/dUVil6rO6 VMMOZPJ9urwPQ3QFJCgCy+asEJADrs9qRwaTlQN7U0ZCrG5bwTg2m/ixn299DpCyB0bU wGjA== 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=ao2zNPPAVKm6DVngcSIODmeIuZt8Da7c4FKcqwlcUWs=; b=iG894X6Jt23lkzfhOCYCDnuNyYAcziovbS15PRjfERej+d0pIY/cJT0v7hoYrfs9PL VinqXL2Rl9u9AQoH7kMnsya+DYyvIhmxKGKyUk6AjIhsxbPSAPKNNqB8ogqGfiThdiat RKroiLRJagZ4VnejvuW2x+XX1eFs/je9awcNCGmAj1hVLDG+SrBq8AUKDwfwXvjhh4nq CSDFnF738jJQIN56LTTxwQy7eovTPPDoVNgWI8duNgIpdC1GN0Lufb4pLFJyPF9x5zqG AGvo0lfoNFcbCnJEnrfaouC2O17Hau2hFk6Q5Yg+yNOe7plbkn7biK6Q7wDxQ2RZTJea Sxyw== X-Gm-Message-State: AHQUAuZT2cPxPiCr0PXryydSgcxms+bDvn06DqcR+8rwcjJi6TaRobgR lG9LcFOwE3i72zgeVr1FJKj3cQcI X-Google-Smtp-Source: AHgI3Ib063IR4oXphlNEnw5EUM6dccVs/KVPVRN+fklLvH0axGg1PfPynsFO4dxwzyS+e/OVR7NFCw== X-Received: by 2002:ac8:2c51:: with SMTP id e17mr1032432qta.254.1550110230310; Wed, 13 Feb 2019 18:10:30 -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 d63sm1091575qka.22.2019.02.13.18.10.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 18:10:29 -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.14 V2 04/17] ARM: 8792/1: oabi-compat: copy oabi events using __copy_to_user() Date: Wed, 13 Feb 2019 21:10:09 -0500 Message-Id: <20190214021022.5313-5-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214021022.5313-1-dave.long@linaro.org> References: <20190214021022.5313-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 4abe4909417f..a87684532327 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);