lkml.org 
[lkml]   [2010]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] RFC: p9auth: add p9auth fs
On 04/27, Serge E. Hallyn wrote:
>
> This introduces a Plan 9 style setuid capability filesystem.
> See Documentation/p9auth.txt for a description of how to use this.

Can't comment these changes due to the lack of knowledge, just
a couple of minor nits.

> +static ssize_t p9auth_use_write(struct file *file, const char __user *buffer,
> + size_t count, loff_t *ppos)
> +{
> + ssize_t retval = -ENOMEM;
> + char *user_buf;
> +
> + if (mutex_lock_interruptible(&cap_mutex))
> + return -EINTR;

EINTR doesn't look exactly right here, especially if TIF_SIGPENDING is
spurious. Probably ERESTARTNOINTR makes more sense. Or mutex_lock_killable().

> + user_buf = kzalloc(count+1, GFP_KERNEL);

Probably this is OK, but it looks a bit strange we do no check that
count is not too large.

> + if (copy_from_user(user_buf, buffer, count)) {
> + retval = -EFAULT;
> + goto out;
> + }
> +
> + retval = use_setuid_capability(user_buf);

It seems that use_setuid_capability() pathes assume that user_buf is
null terminated? Say, parse_user_capability() does kstrdup(user_buf).

Oleg.



\
 
 \ /
  Last update: 2010-04-28 13:23    [W:0.087 / U:7.548 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site