From 14d0604ac749c8cadd9d91ade6c61401c4931b76 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 25 Mar 2016 20:24:41 +0000 Subject: [PATCH] syscall_fs2: chown rules Under non-historic unix you don't get to chown a file to a group you are not a member of --- Kernel/syscall_fs2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/syscall_fs2.c b/Kernel/syscall_fs2.c index 3ef77639..41cd1c70 100644 --- a/Kernel/syscall_fs2.c +++ b/Kernel/syscall_fs2.c @@ -244,7 +244,8 @@ arg_t _fchmod(void) static int chown_op(inoptr ino) { - if (ino->c_node.i_uid != udata.u_euid && esuper()) + if ((ino->c_node.i_uid != udata.u_euid || + (group != udata.u_gid && !in_group(group))) && esuper()) return (-1); if (ino->c_flags & CRDONLY) { udata.u_error = EROFS; -- 2.34.1