From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D3BBFA372C for ; Fri, 8 Nov 2019 19:23:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D8212085B for ; Fri, 8 Nov 2019 19:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573241003; bh=KuEGhGvrf+Y8d/9sC1NdeZT6gWEn8hRQP5v7AZ6Scgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ehfDo67cJuKx7syZp46nOAg7EsmFiyxMeOOe8a3AMTRirkH09bXLF2AuIMupULjcU vFwFhUu4LV5XULbUVq2ruTHAyb55PaWSqp9Tp6OX2ZexKkoWzBVtTk6G9wOrWprMnT LLUtbr9qH+wSW77SELmS9PDQfwuMpdXA7SGPOdE0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733038AbfKHSym (ORCPT ); Fri, 8 Nov 2019 13:54:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:51750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733041AbfKHSyl (ORCPT ); Fri, 8 Nov 2019 13:54:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A073214DB; Fri, 8 Nov 2019 18:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573239281; bh=KuEGhGvrf+Y8d/9sC1NdeZT6gWEn8hRQP5v7AZ6Scgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aS96N5DMuEyP3/BYDDAfA435YKDyeYC4rDkk4muJvW1TAaWkOoc/S48WR0hEFbet9 zXX2S/uJL5Shougmn6S6AAaZLIdBkECMS9nKauoAz2n0iLigO8aKU+5grkW0UqM7vL 9s5vdZkx6Qyi2eRQT6bj7pkYTmYgBWtuAf4Qhyds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Julien Thierry , Russell King , "David A. Long" , Sasha Levin , Ard Biesheuvel Subject: [PATCH 4.4 61/75] ARM: 8792/1: oabi-compat: copy oabi events using __copy_to_user() Date: Fri, 8 Nov 2019 19:50:18 +0100 Message-Id: <20191108174801.921987093@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191108174708.135680837@linuxfoundation.org> References: <20191108174708.135680837@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.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 Reviewed-by: Julien Thierry Signed-off-by: Sasha Levin Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/sys_oabi-compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- 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 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 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);