mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 06:10:56 +00:00
idr: Fix idr_alloc_u32 on 32-bit systems
[ Upstream commit b7e9728f3d
]
Attempting to allocate an entry at 0xffffffff when one is already
present would succeed in allocating one at 2^32, which would confuse
everything. Return -ENOSPC in this case, as expected.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
88358c7610
commit
8ef58b82d1
1 changed files with 1 additions and 1 deletions
|
@ -2172,7 +2172,7 @@ void __rcu **idr_get_free(struct radix_tree_root *root,
|
|||
offset = radix_tree_find_next_bit(node, IDR_FREE,
|
||||
offset + 1);
|
||||
start = next_index(start, node, offset);
|
||||
if (start > max)
|
||||
if (start > max || start == 0)
|
||||
return ERR_PTR(-ENOSPC);
|
||||
while (offset == RADIX_TREE_MAP_SIZE) {
|
||||
offset = node->offset + 1;
|
||||
|
|
Loading…
Reference in a new issue