linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl()
@ 2020-04-15 15:16 Russell King
  2020-04-20 10:21 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Russell King @ 2020-04-15 15:16 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Alexander Viro

We no longer need to switch to KERNEL_DS mode in sys_oabi_epoll_ctl()
as we can use do_epoll_ctl() to avoid the additional copy.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 arch/arm/kernel/sys_oabi-compat.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index 17bd32b22371..0203e545bbc8 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -253,20 +253,15 @@ asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd,
 {
 	struct oabi_epoll_event user;
 	struct epoll_event kernel;
-	mm_segment_t fs;
-	long ret;
 
-	if (op == EPOLL_CTL_DEL)
-		return sys_epoll_ctl(epfd, op, fd, NULL);
-	if (copy_from_user(&user, event, sizeof(user)))
+	if (ep_op_has_event(op) &&
+	    copy_from_user(&user, event, sizeof(user)))
 		return -EFAULT;
+
 	kernel.events = user.events;
 	kernel.data   = user.data;
-	fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_epoll_ctl(epfd, op, fd, &kernel);
-	set_fs(fs);
-	return ret;
+
+	return do_epoll_ctl(epfd, op, fd, &kernel, false);
 }
 
 asmlinkage long sys_oabi_epoll_wait(int epfd,
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl()
  2020-04-15 15:16 [PATCH] arm: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl() Russell King
@ 2020-04-20 10:21 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2020-04-20 10:21 UTC (permalink / raw)
  To: Russell King; +Cc: Alexander Viro, linux-arm-kernel

On Wed, Apr 15, 2020 at 04:16:48PM +0100, Russell King wrote:
> We no longer need to switch to KERNEL_DS mode in sys_oabi_epoll_ctl()
> as we can use do_epoll_ctl() to avoid the additional copy.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-20 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-15 15:16 [PATCH] arm: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl() Russell King
2020-04-20 10:21 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).