[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: [PATCH] device_cgroup: fix unchecked cgroup parent usage
From:       Andrew Morton <akpm () linux-foundation ! org>
Date:       2012-10-31 23:35:01
Message-ID: 20121031163501.79a0950e.akpm () linux-foundation ! org
[Download RAW message or body]

On Wed, 31 Oct 2012 12:04:30 -0400
Aristeu Rozanski <aris@redhat.com> wrote:

> In 4cef7299b4786879a3e113e84084a72b24590c5b the cgroup parent usage is
> unchecked. root will not have a parent and trying to use
> device.{allow,deny} will cause problems.

From my reading of the code "problems" means "kernel null pointer
dereference".

> For some reason my stressing
> scripts didn't test the root directory so I didn't catch it on my
> regular tests.
> 
> --- github.orig/security/device_cgroup.c	2012-10-26 17:18:01.739366780 -0400
> +++ github/security/device_cgroup.c	2012-10-29 10:03:33.221918003 -0400
> @@ -352,6 +352,8 @@
>   */
>  static inline int may_allow_all(struct dev_cgroup *parent)

offtopic: this function could quite neatly have a bool return type.

>  {
> +	if (!parent)
> +		return 1;

hm.  Does it need a comment explaining what and why?  I guess not...  just.

>  	return parent->behavior == DEVCG_DEFAULT_ALLOW;
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic