Re: [PATCH] nfsd/nfs4acl: Number of used used array elements needs to be zeroed.

Previous thread: [PATCH] Revert commit e8aa4667baf74dfd85fbaab86861465acb811085 by Andreas Herrmann on Thursday, September 4, 2008 - 7:46 am. (8 messages)

Next thread: panic on boot with kernel/sysctl.c changes in 2.6.27-rc5 by James Bottomley on Thursday, September 4, 2008 - 8:04 am. (3 messages)
From: Jiri Pirko
Date: Thursday, September 4, 2008 - 7:55 am

Number of used used array elements needs to be zeroed. It may cause
problems otherwise, because it's used uninitialized in find_uid().

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 fs/nfsd/nfs4acl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 54b8b41..7dcd90f 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -447,11 +447,13 @@ init_state(struct posix_acl_state *state, int cnt)
 	state->users = kzalloc(alloc, GFP_KERNEL);
 	if (!state->users)
 		return -ENOMEM;
+	state->users->n = 0;
 	state->groups = kzalloc(alloc, GFP_KERNEL);
 	if (!state->groups) {
 		kfree(state->users);
 		return -ENOMEM;
 	}
+	state->groups->n = 0;
 	return 0;
 }
 
-- 
1.5.5.1

--

From: J. Bruce Fields
Date: Thursday, September 4, 2008 - 8:01 am

Thanks for the extra eyes on this code, but: surely the kzalloc()'s are
all that's necessary?  Am I missing something?

--b.
--

From: Benny Halevy
Date: Thursday, September 4, 2008 - 9:40 am

quickly browsing over the code, shouldn't it be:

diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index b6ed383..54b8b41 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -443,7 +443,7 @@ init_state(struct posix_acl_state *state, int cnt)
 	 * enough space for either:
 	 */
 	alloc = sizeof(struct posix_ace_state_array)
-		+ cnt*sizeof(struct posix_ace_state);
+		+ cnt*sizeof(struct posix_user_ace_state);
 	state->users = kzalloc(alloc, GFP_KERNEL);
 	if (!state->users)
 		return -ENOMEM;

--

From: J. Bruce Fields
Date: Thursday, September 4, 2008 - 9:51 am

Yep, see 91b80969ba466ba4b915a4a1d03add8c297add3f.--b.
--

From: david m. richter
Date: Thursday, September 4, 2008 - 9:47 am

:) heheheh, we could've used your sharp eyes last week when we 
were dealing with ACL shenanigans -- i believe that this is covered in one 
of the patches that bruce sent out in the last few days.

	d
--

From: Jiri Pirko
Date: Thursday, September 4, 2008 - 3:20 pm

On Thu, 4 Sep 2008 11:01:01 -0400
Sure you are right. Sorry, my bad...

--

Previous thread: [PATCH] Revert commit e8aa4667baf74dfd85fbaab86861465acb811085 by Andreas Herrmann on Thursday, September 4, 2008 - 7:46 am. (8 messages)

Next thread: panic on boot with kernel/sysctl.c changes in 2.6.27-rc5 by James Bottomley on Thursday, September 4, 2008 - 8:04 am. (3 messages)