Skip to content

Commit

Permalink
ARM: dma-mapping: fix error path for memory allocation failure
Browse files Browse the repository at this point in the history
This patch fixes incorrect check in error path. When the allocation of
first page fails, the kernel ops appears due to accessing -1 element of
the pages array.

Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
  • Loading branch information
Marek Szyprowski committed Jul 30, 2012
1 parent 50262a4 commit 9fa8af9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t

return pages;
error:
while (--i)
while (i--)
if (pages[i])
__free_pages(pages[i], 0);
if (array_size <= PAGE_SIZE)
Expand Down

0 comments on commit 9fa8af9

Please sign in to comment.