[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Jun 10 14:28:52 MDT 2010


The branch, master has been updated
       via  b53f8c1... Since idtree assigns sequentially, it rarely reaches high numbers. But such numbers can be forced with idr_get_new_above(), and that reveals two bugs:
      from  321d7a6... Implement AIO in SMB2. Doesn't allow cancel calls yet (to be added).

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b53f8c187de8c8aff5989e4a0a460970f89b9011
Author: Rusty Russell <rusty at rustorp.com.au>
Date:   Thu Jun 10 13:27:51 2010 -0700

    Since idtree assigns sequentially, it rarely reaches high numbers.
    But such numbers can be forced with idr_get_new_above(), and that
    reveals two bugs:
    
    1) Crash in sub_remove() caused by pa array being too short.
    2) Shift by more than 32 in _idr_find(), which is undefined, causing
       the "outside the current tree" optimization to misfire and return NULL.

-----------------------------------------------------------------------

Summary of changes:
 lib/util/idtree.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/idtree.c b/lib/util/idtree.c
index 0af93a2..c147961 100644
--- a/lib/util/idtree.c
+++ b/lib/util/idtree.c
@@ -240,7 +240,7 @@ build_up:
 static int sub_remove(struct idr_context *idp, int shift, int id)
 {
 	struct idr_layer *p = idp->top;
-	struct idr_layer **pa[MAX_LEVEL];
+	struct idr_layer **pa[1+MAX_LEVEL];
 	struct idr_layer ***paa = &pa[0];
 	int n;
 
@@ -280,8 +280,10 @@ static void *_idr_find(struct idr_context *idp, int id)
 	 * This tests to see if bits outside the current tree are
 	 * present.  If so, tain't one of ours!
 	 */
-	if ((id & ~(~0 << MAX_ID_SHIFT)) >> (n + IDR_BITS))
-	     return NULL;
+	if (n + IDR_BITS < 31 &&
+	    ((id & ~(~0 << MAX_ID_SHIFT)) >> (n + IDR_BITS))) {
+		return NULL;
+	}
 
 	/* Mask off upper bits we don't use for the search. */
 	id &= MAX_ID_MASK;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list