Merge "idr: fix a subtle bug in idr_get_next()"

This commit is contained in:
Linux Build Service Account
2013-12-11 11:17:33 -08:00
committed by Gerrit - the friendly Code Review server
+8 -1
View File
@@ -625,7 +625,14 @@ void *idr_get_next(struct idr *idp, int *nextidp)
return p;
}
id += 1 << n;
/*
* Proceed to the next layer at the current level. Unlike
* idr_for_each(), @id isn't guaranteed to be aligned to
* layer boundary at this point and adding 1 << n may
* incorrectly skip IDs. Make sure we jump to the
* beginning of the next layer using round_up().
*/
id = round_up(id + 1, 1 << n);
while (n < fls(id)) {
n += IDR_BITS;
p = *--paa;