lkml.org 
[lkml]   [2010]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/3] RFC: p9auth: add p9auth fs
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@us.ibm.com>
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@us.ibm.com>
---
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


\
 
 \ /
  Last update: 2010-05-04 01:53    [W:0.041 / U:0.324 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site