| From dhobsong@igel.co.jp Mon Oct 29 00:53:35 2012 |
| From: Damian Hobson-Garcia <dhobsong@igel.co.jp> |
| Date: Mon, 29 Oct 2012 16:51:00 +0900 |
| Subject: [PATCH v2 43/58] ARM: dma-mapping: fix error path for memory allocation failure |
| To: greg@kroah.com, laurent.pinchart@ideasonboard.com, horms@verge.net.au |
| Cc: ltsi-dev@lists.linuxfoundation.org, dhobsong@igel.co.jp |
| Message-ID: <1351497075-32717-44-git-send-email-dhobsong@igel.co.jp> |
| |
| |
| From: Marek Szyprowski <m.szyprowski@samsung.com> |
| |
| 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> |
| (cherry picked from commit 9fa8af91f0679f2abbebe1382b937264f3a8b981) |
| |
| Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp> |
| --- |
| arch/arm/mm/dma-mapping.c | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| --- a/arch/arm/mm/dma-mapping.c |
| +++ b/arch/arm/mm/dma-mapping.c |
| @@ -963,7 +963,7 @@ static struct page **__iommu_alloc_buffe |
| |
| return pages; |
| error: |
| - while (--i) |
| + while (i--) |
| if (pages[i]) |
| __free_pages(pages[i], 0); |
| if (array_size <= PAGE_SIZE) |