ida: Free allocated bitmap in error path

[ Upstream commit a219b856a2b993da234108307be772448f22b0ce ]

If a bitmap needs to be allocated, and then by the time the thread
is scheduled to be run again all the indices which would satisfy the
allocation have been allocated then we would leak the allocation.  Almost
impossible to hit in practice, but a trivial fix.  Found by Coverity.

Fixes: f32f004cdd ("ida: Convert to XArray")
Reported-by: coverity-bot <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
Matthew Wilcox (Oracle) 2020-04-02 14:26:13 -04:00 • committed by Greg Kroah-Hartman
commit 2577720d35
2 changed files with 30 additions and 0 deletions

View file

@ -470,6 +470,7 @@ alloc:
goto retry;
nospc:
xas_unlock_irqrestore(&xas, flags);
kfree(alloc);
return -ENOSPC;
}
EXPORT_SYMBOL(ida_alloc_range);