Re: [PATCH 3/3] RFC: p9auth: add p9auth fs

From: Serge E. Hallyn
Date: Mon May 03 2010 - 19:50:32 EST


Thanks for the comments, Oleg. I will fold this patch into the
main patch, but I'll spare everyone a full repost right now.

thanks,
-serge

From: Serge E. Hallyn <serue@xxxxxxxxxx>
Subject: [PATCH 1/1] p9auth: address feedback

Address two comments by Oleg:

Return -ERESTARTNOINTR rather than -EINTR if we are interrupted
while waiting on cap_mutex. And check size of input buffer for
something sane. A user with hundreds of auxilliary groups could
end up with a > PAGE_SIZE message, so maybe this is a bit too
stringent, but I'm not sure how realistic that is.

Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx>
---
kernel/p9auth.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/p9auth.c b/kernel/p9auth.c
index a174373..5f89b4d 100644
--- a/kernel/p9auth.c
+++ b/kernel/p9auth.c
@@ -354,7 +354,10 @@ static ssize_t p9auth_grant_write(struct file *file, const char __user *buffer,
char *user_buf;

if (mutex_lock_interruptible(&cap_mutex))
- return -EINTR;
+ return -ERESTARTNOINTR;
+
+ if (count > PAGE_SIZE)
+ return -E2BIG;

user_buf = kzalloc(count+1, GFP_KERNEL);
if (!user_buf)
@@ -387,7 +390,10 @@ static ssize_t p9auth_use_write(struct file *file, const char __user *buffer,
char *user_buf;

if (mutex_lock_interruptible(&cap_mutex))
- return -EINTR;
+ return -ERESTARTNOINTR;
+
+ if (count > PAGE_SIZE)
+ return -E2BIG;

user_buf = kzalloc(count+1, GFP_KERNEL);
if (!user_buf)
--
1.7.0.4

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