From patchwork Thu Feb 14 14:49:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158397 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1462134jaa; Thu, 14 Feb 2019 06:49:37 -0800 (PST) X-Received: by 2002:a37:9a85:: with SMTP id c127mr3029622qke.273.1550155777301; Thu, 14 Feb 2019 06:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550155777; cv=none; d=google.com; s=arc-20160816; b=h0ytx6SV+BQboECL8MuAYmO98CwFtynxE6dVNIwUVPUflp0AypLnr9sOQSiDoTdoiF jNjAu+Goy74K41BtaCZyC93/h3fMMNnOS53aBMThAcq88AhfLnpl0eQSxFD5MzTnCEqE LENR5y8yV6Ec4DzMok3vFI7jiarHtwECyn8/hrV5kbHUEEPMutjmw8O1NQvlGn7ZfUow gYZuCt/8p6n8kLx18CKL1/POEoLIMqA4NodEYkWfw5NxLERueULbzzZjQA8SBu9/wB73 ysvAD5oI+agAmgXWkkx8HFjWs7IMTn8Rj0KUjnLRmlGKM7vFj+nTOTNT1CiTal5dj8j7 vwlQ== 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=MmV7tN/knUgUsr5/TOMZopkZ7lVFuxceU9ssNxtaR8I=; b=lh6CSly7FtFaBhfBiGp/6eCppREtiMritLgmQDroTIJ/gV0LrdVtKHEBIo2Tj6DfJS 41NG/1X8C2k8sH/qs6Z9ZBSMUliUjKAxD3OkVyxfyIvixK41lJ1IS1z+7LpNBZPqCI5c JOcw94NPrVeQwAdm2AhPW029GLXKoCk+glMUi7GK376BCcYuF2bJBv0RFaWlnIE2JHYI oApAX+yRDDC3Y6dcyeCh/pESDbe4RqAHUxsCP1S2dxH6T+FFIz89lGeEdfv1kABg+5YS ENNqnLY0Ro9rdlqH2cZeMR7jdoEoWzZz2FdvOWtfZni7J9OfkbseVxqaxorv0oYtNHbD Y8ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pVsQgHTe; 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 l6sor3215020qte.24.2019.02.14.06.49.37 for (Google Transport Security); Thu, 14 Feb 2019 06:49:37 -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=pVsQgHTe; 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=MmV7tN/knUgUsr5/TOMZopkZ7lVFuxceU9ssNxtaR8I=; b=pVsQgHTensRPPDJjhW9eW0OSmKFdVMsJXvTV9Wc4PvA8CHgSyb7wXjaB8cRdBYremx 9U6G05RYzbgS7R1ZHlXok7xqM/+QFjru+/prg0CxFiVwEDe1HsXgyODuhH7WoIGJcqIL jjw/FU1o4ox5q8fL9ICBTC0TQbO0wF5O4qVEsz8+9dk+GAWrl7lvvrrOdPQEkOmYdREb s8qe4Gg3w9D1jaCDMQo196jzjVlrWXaybqK1kDWmj7WniLHSzByyuRTmkRk5KOcIuZqE Ad94JzkLfd0SUPIVi5ThlGcigDgaXNyTqQpyXth93478x4TJdqnfPokQFBpY2v0zTvGE AX/A== 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=MmV7tN/knUgUsr5/TOMZopkZ7lVFuxceU9ssNxtaR8I=; b=dGK66iAL4q5OG1bpprregH6qCKheYDDw1fDsEqfWHibZpGzgE4G/xrIy+X0oL9GIgl cO8plx7KGDRdJLvOa6rQvAo58SbS51My6/fxK11/YdsBTQQixig5yGZoTcGqeOSWrvBS 4W+AErpG+hUvRa4kdhzcWjNhl6A8eB2+2IcVyihHgo6czsQfO51Yt5xVESbxUUgVNZph /YvdfnHus98VnsGlRBfPH90kTis6YUgyhsner4c6mwI/0/bMpkSPRxqpLL9VcBtzGBU5 bu5iVp8/zVgW87tqrmLIRM93UKw1jgbV30MMBr+KRD5LdGFJ8mKbIYxGJI57gJ4lw/Kw ZAuw== X-Gm-Message-State: AHQUAuZoWCX7B3IfIOjGOZQuFs9jiGlxJQvCg+XmdDGnAZHcFr5tU+XV spC+YQQ3XdzWQfWAN1+tRY1OhRMC X-Google-Smtp-Source: AHgI3IbLsO6VEuV/Z+JIsyBOU+wJEJMgVHjY6xzsf3vyOhlYoTJwa8+CCw0djgURk4585epwQbVivA== X-Received: by 2002:ac8:1413:: with SMTP id k19mr785431qtj.134.1550155777063; Thu, 14 Feb 2019 06:49:37 -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 k66sm1498919qkc.25.2019.02.14.06.49.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 06:49:36 -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.9 03/16] ARM: 8792/1: oabi-compat: copy oabi events using __copy_to_user() Date: Thu, 14 Feb 2019 09:49:17 -0500 Message-Id: <20190214144930.27539-4-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214144930.27539-1-dave.long@linaro.org> References: <20190214144930.27539-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 640748e27035..d844c5c9364b 100644 --- a/arch/arm/kernel/sys_oabi-compat.c +++ b/arch/arm/kernel/sys_oabi-compat.c @@ -276,6 +276,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; @@ -294,8 +295,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);