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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Serge E. Hallyn
Date: Monday, May 3, 2010 - 4:50 pm

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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/3] RFC: p9auth: add p9auth fs, Serge E. Hallyn, (Tue Apr 27, 9:45 am)
Re: [PATCH 3/3] RFC: p9auth: add p9auth fs, Oleg Nesterov, (Wed Apr 28, 4:17 am)
Re: [PATCH 3/3] RFC: p9auth: add p9auth fs, Serge E. Hallyn, (Wed Apr 28, 8:10 am)
Re: [PATCH 3/3] RFC: p9auth: add p9auth fs, Oleg Nesterov, (Wed Apr 28, 8:39 am)
Re: [PATCH 3/3] RFC: p9auth: add p9auth fs, Serge E. Hallyn, (Mon May 3, 4:50 pm)