From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755944AbYGHBxU (ORCPT ); Mon, 7 Jul 2008 21:53:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755566AbYGHBwv (ORCPT ); Mon, 7 Jul 2008 21:52:51 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:53276 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1755461AbYGHBwu (ORCPT ); Mon, 7 Jul 2008 21:52:50 -0400 Message-ID: <4872C80D.8060701@cn.fujitsu.com> Date: Tue, 08 Jul 2008 09:51:09 +0800 From: Li Zefan User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: Andrew Morton CC: LKML , "Serge E. Hallyn" , Paul Menage , Pavel Emelianov Subject: [PATCH 2/3] devcgroup: fix permission check when adding entry to child cgroup Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org # cat devices.list c 1:3 r # echo 'c 1:3 w' > sub/devices.allow # cat sub/devices.list c 1:3 w As illustrated, the parent group has no write permission to /dev/null, so it's child should not be allowed to add this write permission. Signed-off-by: Li Zefan Acked-by: Serge Hallyn --- security/device_cgroup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 1e2e28a..ddd92ce 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c @@ -300,7 +300,7 @@ static int may_access_whitelist(struct dev_cgroup *c, continue; if (whitem->minor != ~0 && whitem->minor != refwh->minor) continue; - if (refwh->access & (~(whitem->access | ACC_MASK))) + if (refwh->access & (~whitem->access)) continue; return 1; } -- 1.5.4.rc3