public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] devcgroup: fix permission check when adding entry to child cgroup
@ 2008-07-05  5:39 Li Zefan
  2008-07-07 15:48 ` Serge E. Hallyn
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zefan @ 2008-07-05  5:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML, Serge E. Hallyn, Pavel Emelianov

 # 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 its child should not be allowed to add this write permission,
which is documented in Documentation/controllers/devices.txt.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 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

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

* Re: [PATCH 2/2] devcgroup: fix permission check when adding entry to child cgroup
  2008-07-05  5:39 [PATCH 2/2] devcgroup: fix permission check when adding entry to child cgroup Li Zefan
@ 2008-07-07 15:48 ` Serge E. Hallyn
  0 siblings, 0 replies; 2+ messages in thread
From: Serge E. Hallyn @ 2008-07-07 15:48 UTC (permalink / raw)
  To: Li Zefan; +Cc: Andrew Morton, LKML, Pavel Emelianov

Quoting Li Zefan (lizf@cn.fujitsu.com):
>  # 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 its child should not be allowed to add this write permission,
> which is documented in Documentation/controllers/devices.txt.
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>

I have no idea where that came from (but see that it was in my original
submission).  Maybe I meant to do &, but that still isn't necessary.

Acked-by: Serge Hallyn <serue@us.ibm.com>

thanks,
-serge

> ---
>  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

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

end of thread, other threads:[~2008-07-07 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-05  5:39 [PATCH 2/2] devcgroup: fix permission check when adding entry to child cgroup Li Zefan
2008-07-07 15:48 ` Serge E. Hallyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox